It seems that Laravel needs User models (users which are about to authenticate) to implement Authenticable interface.
96 lines
1.7 KiB
PHP
96 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class User
|
|
*/
|
|
class User extends Model implements Authenticatable
|
|
{
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'email',
|
|
'username',
|
|
'password',
|
|
'remember_token',
|
|
'name',
|
|
'status'
|
|
];
|
|
|
|
protected $guarded = [];
|
|
|
|
/**
|
|
* The attributes excluded from the model's JSON form.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $hidden = [
|
|
'password', 'remember_token',
|
|
];
|
|
|
|
/**
|
|
* Get the name of the unique identifier for the user.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getAuthIdentifierName()
|
|
{
|
|
return $this->email;
|
|
}
|
|
|
|
/**
|
|
* Get the unique identifier for the user.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function getAuthIdentifier()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* Get the password for the user.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getAuthPassword()
|
|
{
|
|
return $this->password;
|
|
}
|
|
|
|
/**
|
|
* Get the token value for the "remember me" session.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getRememberToken()
|
|
{
|
|
return $this->remember_token;
|
|
}
|
|
|
|
/**
|
|
* Set the token value for the "remember me" session.
|
|
*
|
|
* @param string $value
|
|
*
|
|
* @return void
|
|
*/
|
|
public function setRememberToken($value)
|
|
{
|
|
$this->remember_token = $value;
|
|
}
|
|
|
|
/**
|
|
* Get the column name for the "remember me" token.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getRememberTokenName()
|
|
{
|
|
return 'remember_token';
|
|
}} |