skip to Main Content

Laravel – Accessing path params of FormRequest

I have this code: class BunnyUpdateRequest extends FormRequest { public function authorize(): bool { return true; } public function rules(): array { return [ 'id' => ['required', 'min:1'], 'status' => ['required', Rule::enum(BunnyStatus::class)] ]; } public function validationData(){ return array_merge($this->all(), […

VIEW QUESTION

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
Back To Top
Search