skip to Main Content

Laravel – Splitting up query with join, using load in strict mode

I wrote a code something like this: $bunnies = Bunny::with(['carrots' => function ($query) use ($request){ if (empty($request->carrotStatus)) return; $query->where('status', $request->carrotStatus); }, 'owner']) ->select('bunnies.*') ->join('carrots', 'bunnies.id', '=', 'carrots.bunny_id') ->where(function (Builder $query) use ($request){ if (empty($request->carrotStatus)) return; $query->where('carrots.status', $request->carrotStatus); }) ->where(function (Builder…

VIEW QUESTION

Laravel – How to use the can() method on update routes?

I read here that in Laravel we can use the can method instead of the traditional middleware call on a route. https://laravel.com/docs/11.x/authorization#middleware-actions-that-dont-require-models use AppModelsPost; Route::post('/post', function () { // The current user may create posts... })->can('create', Post::class); Now the traditional…

VIEW QUESTION

Laravel 11 and mailtrap

I have created a Laravel 11 app and I am using mailtrap to send mails and when I send password reset link and verification mail it shows that the mail has been sent yet on the mailtrap inbox it's not…

VIEW QUESTION
Back To Top
Search