Passport: createToken throws BadMethodCallException

Created on 12 Feb 2017  路  2Comments  路  Source: laravel/passport

I am running CENTOS 7.3 x86_64 Apache/2.4.25

I performed all the steps per the docs: https://laravel.com/docs/5.3/passport

Locally, I can run:

$user = App\User::find(1);

// Creating a token without scopes...
$token = $user->createToken('Token Name')->accessToken;

and it creates and returns the key... however, when I deploy live I get the following:

BadMethodCallException in Builder.php line 2508:
Call to undefined method Illuminate\Database\Query\Builder::createToken()

I have asked many about this issue but no one seems to have an answer. Any help would be appreciated.

Most helpful comment

[SOLVED] - My User model on the server was missing use HasApiTokens

All 2 comments

[SOLVED] - My User model on the server was missing use HasApiTokens

make sure that in User.php you have this traits use HasApiTokens,Notifiable;

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adaojunior picture adaojunior  路  52Comments

tobecwb picture tobecwb  路  30Comments

siarheipashkevich picture siarheipashkevich  路  60Comments

jimmylagp picture jimmylagp  路  32Comments

OscarRPR picture OscarRPR  路  48Comments