What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-01-25 01:40:16
laravel eloquent relationships
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-01-22 20:06:58
eloquent relationships
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 -
Other 2022-01-22 10:50:56
laravel eloquent relationship
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 2021-11-21 04:41:18
laravel select subquery
In addition to @delmadord's answer and your comments: Currently there is no method to create subquery in FROM clause, so you need to manually use raw statement, then, if necessary, you will merge all the bindings: $sub = Abc::where(..)->groupBy(..); ... Add solution -
Other 2021-11-17 19:59:25
Class must be declared abstract or implement methods 'hasVerifiedEmail'
You need to either extend Illuminate\Foundation\Auth\User instead of Illuminate\Database\Eloquent\Model, or use Illuminate\Auth\Authenticatable trait in your class You need to extend Illuminate\Foundation\Auth\User like this use Illuminate\Foundation\... Add solution -
PHP 2021-11-16 06:54:19
laravel belongs to
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 2021-11-15 04:42:08
laravel eloquent with
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 -
TypeScript 2021-11-14 07:58:16
AND-OR-AND + brackets with Eloquent
//mysql query be like this // ... WHERE (gender = 'Male' and age >= 18) or (gender = 'Female' and age >= 65) //Eloquent query is // ... $q->where(function ($query) { $query->where('gender', 'Male') ->where('age', '>=', 18);... Add solution -
PHP 2021-11-12 17:26:08
Indirect modification of overloaded property has no effect laravel
Due to how accessing model attributes is implemented in Eloquent, when you access $category->specifics, a magic __get() method is called that returns a copy of that attributes value. Therefore, when you add an element to that copy, you are just chang... Add solution
Best helpers
Ranking is empty