Answer the question
In order to leave comments, you need to log in
Get relation based on parent id?
Hello!
Perhaps the question is not very clear, but I will try to explain with an example.
There is a code:
$specialities = Speciality::with([
'educationals' => function ($query) {
return $query->with([
'specialities' => function ($query) {
//dd($query);
//return $query->where('speciality_id', $speciality->id);
}
])
->take(3);
}
])
->paginate(10);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question