Search Polymorphic relation in Laravel -
i'm using polymorphic relation store follower/following information users. list of following users, use:
$following = user::with('following')->findorfail($id);
in user.php
,
public function following() { return $this->morphmany('app\like', 'user', 'likeable_type')->with('follower'); }
now, want search particular user in following users. tried:
$followings = $user->following->where('follower.first_name', 'like', "%$query%");
and it's returning nothing. how can search particular user in case?
Comments
Post a Comment