47 lines
947 B
PHP
47 lines
947 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||
|
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||
|
|
||
|
class User extends Authenticatable implements JWTSubject
|
||
|
{
|
||
|
/**
|
||
|
* The attributes that are mass assignable.
|
||
|
*
|
||
|
* @var array
|
||
|
*/
|
||
|
protected array $fillable = [
|
||
|
'email', 'password', 'role'
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* The attributes that should be hidden for arrays.
|
||
|
*
|
||
|
* @var array
|
||
|
*/
|
||
|
protected array $hidden = [
|
||
|
'password', 'created_at', 'updated_at'
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* Get the identifier that will be stored in the subject claim of the JWT.
|
||
|
*
|
||
|
* @return mixed
|
||
|
*/
|
||
|
public function getJWTIdentifier()
|
||
|
{
|
||
|
return $this->getKey();
|
||
|
}
|
||
|
/**
|
||
|
* Return a key value array, containing any custom claims to be added to the JWT.
|
||
|
*
|
||
|
* @return array
|
||
|
*/
|
||
|
public function getJWTCustomClaims()
|
||
|
{
|
||
|
return [];
|
||
|
}
|
||
|
}
|