Laravel’s Passport: How to have an authenticatable model - development

Laravel’s Passport: How to have an authenticatable model

The problem with the Laravel’s Passport tutorial is that it assumes the reader will use the pre-installed User model, that is very different from the simple model we could create with php artisan make:model MyModel.

Here is the code of the pre-installed User model:

<?php
namespace App;
use IlluminateNotificationsNotifiable;
use IlluminateFoundationAuthUser as Authenticatable;
class User extends Authenticatable
{
    use Notifiable;
    protected $fillable = [
        'name', 'email', 'password',
    ];
    protected $hidden = [
        'password', 'remember_token',
    ];
}

And here is the code of a model you could create with php artisan make:model MyModel:

<?php
namespace App;
use IlluminateDatabaseEloquentModel;
class MyModel extends Model
{

}

But what if I want my own custom authenticatable models, say Customer, what should I do to follow the Passport tutorial? Is there an Artisan command that implements all the interfaces, add all the traits and extend the corresponding class for us?

Thank you for your help.



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravels-passport-how-to-have-an-authenticatable-model/
via Lzo Media

Comments

Popular posts from this blog

ng-show doesn’t work correct with value boolean

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development

ng-include of inline SVG does not display gradient except in Chrome