Closed bhdrnzl closed 5 years ago
$recipient
is the authenticated user's id. You need to pass in the actual user. In your example, you could do, $user->befriend(Auth::user())
thanks heidilux, Yesterday I had never tried this way. Working now, I'm happy :)
Argument 1 passed to App\User::befriend() must be an instance of Illuminate\Database\Eloquent\Model, integer given, called in C:\xampp\htdocs\handicraft\app\Http\Controllers\UserController.php on line 185
line 185;
public function friendRequest($nick) { $recipient = Auth::id(); $user = User::where('slug', $nick)->first(); $user->befriend($recipient); return back(); }