dusterio / lumen-passport

Making Laravel Passport work with Lumen
MIT License
655 stars 138 forks source link

User model #14

Closed paolopiccinini closed 7 years ago

paolopiccinini commented 7 years ago

@dusterio maybe in the readme you should say that User model should implements:

use Laravel\Passport\HasApiTokens;
use Illuminate\Auth\Authenticatable;

class User extends Model
{
    use Authenticatable, HasApiTokens;

For example in the laraverl docs they say that users model should do this:

use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;

but using this class we get for example: Fatal error: Class 'Illuminate\Foundation\Auth\User' not found in D:\XamppAmbient\htdocs\RestApi\app\User.php on line

not using Authenticatable trait we get:

lumen.ERROR: exception 'BadMethodCallException' with message 'Call to undefined method Illuminate\Database\Query\Builder::getAuthIdentifier()' in D:\XamppAmbient\htdocs\RestApi\vendor\illuminate\database\Query\Builder.php:2448

what do you think?

dusterio commented 7 years ago

Thanks, I added this to the README!

It's one trait from Passport that has to be added - HasApiTokens