Files
sentadmin/backend/app/Models/Auth/Users.php
2023-02-22 22:32:00 +08:00

58 lines
1.5 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace App\Models\Auth;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class Users extends Authenticatable implements JWTSubject{
use Notifiable;
protected $primaryKey = 'uid';
// Rest omitted for brevity
/**
* 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 [];
}
/**
* @title 角色关联
*
* @return void
*/
public function roles(){
return $this->belongsToMany(Roles::class, UserHasRoles::class, 'role_id', 'uid');
}
/**
* @title 部门关联
*
* @return void
*/
public function department(){
return $this->hasOne(Departments::class, 'id', 'department_id');
}
}