I am using laravel passport and sentinel for developing API. I want to use it with VUE js. But I am getting a problem in oauth/token
.
When I hit the URL I get an error
Call to undefined method Illuminate\Database\Query\Builder::getAuthPassword()
My User Model code is
namespace App;
use Cartalyst\Sentinel\Users\EloquentUser;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends EloquentUser
{
use HasApiTokens, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'email',
'password',
'name',
'permissions',
'photo_id'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function findForPassport($username) {
return $this->where('email', $username)->first();
}
public function photo(){
return $this->belongsTo('App\Photo');
}
}
If I use Class User extends Authenticatable
then it works and get
status: 200, statusText: "OK"
, But if I use EloquentUser
then I get error
Call to undefined method Illuminate\Database\Query\Builder:: getAuthPassword()
How to solve this problem?
The answer is in the error.
Call to undefined method Illuminate\Database\Query\Builder::getAuthPassword()
So I just put Authenticatable trait as Use Authenticatable;
and import the class in namespace
use Illuminate\Auth\Authenticatable;