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



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire