trying to execute the following query on the FriendController
$friends = Auth::User()->friends;
and that is the friends function on the User model
public function friends()
{
return $this->belongsToMany('App\Friend', 'friends', 'user_id', 'friend_id');
}
but on hitting the route i get the following error
Illuminate \ Database \ QueryException (42000) SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'friends' (SQL: select
friends.*,friends.user_idaspivot_user_id,friends.friend_idaspivot_friend_idfromfriendsinner joinfriendsonfriends.id=friends.friend_idwherefriends.user_id= 2)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire