Laravel Eloquent Use Where For Relationship Table

[Solved] Laravel Eloquent Use Where For Relationship Table | Php - Code Explorer | yomemimo.com
Question : how to use where relationship laravel

Answered by : alive-angelfish-8hkpto2y9706

Event::with(["owner", "participants" => function($q) use($someId){ $q->where('participants.IdUser', '=', 1); //$q->where('some other field', $someId);
}])

Source : https://stackoverflow.com/questions/29989908/laravel-where-on-relationship-object | Last Update : Wed, 05 Aug 20

Answers related to laravel eloquent use where for relationship table

Code Explorer Popular Question For Php