laravel-follow
laravel-follow copied to clipboard
Are There Relationships?
I'm getting a list of the logged in user's followers, and it's only returning each follower's ID
auth()->user()->followings
So in order to get the follower's names, I need to do a separate query.
$ids = [];
foreach (auth()->user()->followings as $followed) {
$ids[] = $followed->followable_id;
}
$this->following = User::whereIn('id', $ids)->get();
Is this the correct way? Or are there relationships defined and just not documented? Am I missing something?
The expected behavior to me would be like this
@foreach(auth()->user()->followings as $user)
{{ $user->name }}
@endforeach