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

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -