What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-03-27 12:45:03
laravel hasOne
use Illuminate\Database\Eloquent\Builder; // Retrieve posts with at least one comment containing words like foo%... $posts = App\Post::whereHas('comments', function (Builder $query) { $query->where('content', 'like', 'foo%'); })->get(); // Ret... Add solution -
PHP 2022-02-24 20:55:11
one to many laravel
use Illuminate\Database\Eloquent\Builder; // Retrieve posts with at least one comment containing words like foo%... $posts = App\Post::whereHas('comments', function (Builder $query) { $query->where('content', 'like', 'foo%'); })->get(); // Ret... Add solution -
SQL 2022-02-09 15:15:46
eloquest how to select one specific column in database
//Eloquent: Get specific columns (not all the row). Pluck returns an array. Model::where('id', 1)->pluck('name', 'surname'); // If you only want to get the result value: Model::where('id', 1)->value('name'); Add solution -
PHP 2022-02-06 14:25:03
laravel collection namespace
Illuminate\Database\Eloquent\Collection Add solution
Best helpers
Ranking is empty