entrust
entrust copied to clipboard
Extend the User model from Authenticatable instead \Eloquent
Hello everyone.
I am using the entrust package, and one of the instructions to use it is to change the User model, like this
class User extends Eloquent
And after I make php artisan make:auth to autogenerate the login and sign up views and controllers... the bad thing is that a lot of functions of the method (auth), require that the User model extends from Authenticable, I make this:
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Zizaco\Entrust\Traits\EntrustUserTrait;
class User extends Authenticatable
{
use EntrustUserTrait;
/* more and more*/
}
In this way it seems that everything works... so... is there any really needing to extend from \Eloquent or can I let how I have.
Thank you very much.
try
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Zizaco\Entrust\Traits\EntrustUserTrait;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
use EntrustUserTrait, Authenticatable, CanResetPassword;
/* more and more*/
}
I´ll try, thanks!!
thank u