Created
June 17, 2020 08:06
-
-
Save blogcacanid/69bdd68f9dc5e1d787620f42cbbca834 to your computer and use it in GitHub Desktop.
User.php Rest API Dengan JSON Web Token Laravel 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Illuminate\Contracts\Auth\MustVerifyEmail; | |
use Illuminate\Foundation\Auth\User as Authenticatable; | |
use Illuminate\Notifications\Notifiable; | |
use Tymon\JWTAuth\Contracts\JWTSubject; | |
class User extends Authenticatable implements JWTSubject | |
{ | |
use Notifiable; | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var array | |
*/ | |
protected $fillable = [ | |
'name', 'email', 'password', | |
]; | |
/** | |
* The attributes that should be hidden for arrays. | |
* | |
* @var array | |
*/ | |
protected $hidden = [ | |
'password', 'remember_token', | |
]; | |
/** | |
* The attributes that should be cast to native types. | |
* | |
* @var array | |
*/ | |
protected $casts = [ | |
'email_verified_at' => 'datetime', | |
]; | |
/** | |
* 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 []; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment