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:
Michal Kváček
2016-01-21 01:41:10 +01:00
parent e412fc27fc
commit cff9f7dbac
4 changed files with 80 additions and 17 deletions
+64 -3
View File
@@ -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';
}}