mardi 1 août 2017

Laravel Eloquent one to many relation filter with multiple criteria

Works

$comments = App\Post::find(1)->comments()->where('title', 'foo');

This does not work

$comments = App\Post::where('id', '=', $id)
->where('column', '=', $val)
->comments()->where('title', 'foo');

Expecting to get collection of model filtered by id and column



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2veyPsZ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire