It looks like you are missing get
.
$threads = Thread::whereHas('users', function($query) {
$query->where('owner_id', auth()->user()->id);
})->get();
thomastkim said:
It looks like you are missing
get
.$threads = Thread::whereHas('users', function($query) { $query->where('owner_id', auth()->user()->id); })->get();
Thanks, I tried but it still doesn't work regardless get() or not
Hmm...I could think of / see two things.
You'll see that you need to loop through the related model (in this case, the user), and then access the pivot table.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community