i have this error i use laravel 5.3 Call to undefined method Illuminate\Auth\GenericUser::hasFriendRequestPending() can anyone help me please ?!!
User Model
public function friendsOfMine()
{
return $this->belongsToMany('App\User', 'friends' , 'user_id' , 'friend_id');
}
public function friendOf(){
return $this->belongsToMany('App\User', 'friends' , 'friend_id' , 'user_id' );
}
public function friendRequestsPending()
{
return $this->friendOf()->wherePivot('accepted' , false)->get();
}
public function hasFriendRequestPending(User $user)
{
return (bool) $this->friendRequestsPending()->where('id' , $user->id)->count();
}
in view
<h4>Friend Requests</h4>
@if (Auth::user()->hasFriendRequestPending($user))
<p>Waiting For {{$user->username}} To Accept Your Request. </p>
@endif
auth.php
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],