P
P
Pavel2017-05-05 16:43:23
Laravel
Pavel, 2017-05-05 16:43:23

How to set where for fetching related models?

Maybe I’m looking badly, but I just can’t find a solution, the right method.
There is, for example, the code
$result = MyModel::with('relationship')->find(1);
How to add a condition for related models? to get something like "with relationship where 'column', 'value" ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nurlan, 2017-05-05
@Palych_tw

https://laravel.com/docs/5.4/eloquent-relationship...
https://laravel.com/docs/5.4/eloquent-relationship...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question