Closed tolgatasci closed 7 years ago
The problem seems to be your code, not this library. You need to call the method getAllFriendships
on your User instance, not a query builder instance. If you look the import part of your controller, you can see a wrong import :
use Illuminate\Foundation\Auth\User;
instead of
use App\User;
True! thank you.i forget callback
Error BadMethodCallException in Builder.php line 2508: Call to undefined method Illuminate\Database\Query\Builder::getAllFriendships()
app/user.php `<?php
namespace App; use Hootlex\Friendships\Traits\Friendable; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable {
}
My Controller
namespace App\Http\Controllers; use DB;use Illuminate\Foundation\Auth\User; use Illuminate\Http\Request; use \App\Access_token;
$recipient = User::find(1); var_dump($recipient->getAllFriendships());`