Do you mean something like this?
$users = Users::whereHas('images', function ($q) {
$q->where('isprofile', 1);
})->get();
get all users who have profile images.
foreach ($users as $user) {
$profileImage = $user->images()->where('isprofile', 1)->first();
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community