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

php - Auto increment employee ID -

php - isset function not working properly -

python - Evaluating the next line in a For Loop while in the current iteration -