FEATURE #1358: add interface Authenticable to User model.
It seems that Laravel needs User models (users which are about to authenticate) to implement Authenticable interface.
This commit is contained in:
+64
-3
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class User
|
||||
*/
|
||||
class User extends Model
|
||||
class User extends Model implements Authenticatable
|
||||
{
|
||||
|
||||
public $timestamps = false;
|
||||
@@ -31,5 +32,65 @@ class User extends Model
|
||||
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';
|
||||
}}
|
||||
Reference in New Issue
Block a user