12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace App\Repositories\Models\User;
- use App\Repositories\Models\Model;
- use Database\Factories\UserFactory;
- use Illuminate\Auth\Authenticatable;
- use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
- use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Laravel\Lumen\Auth\Authorizable;
- use Spatie\Permission\Traits\HasRoles;
- use Tymon\JWTAuth\Contracts\JWTSubject;
- /**
- * Class Student.
- *
- * @package namespace App\Repositories\Models\User;
- */
- class User extends Model implements AuthenticatableContract, AuthorizableContract, JWTSubject
- {
- use Authenticatable, Authorizable, HasFactory, HasRoles;
- protected $table = 'base_admins';
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $guarded = [];
- protected $hidden = ['password'];
- /**
- * 兼容 Laravel 8 的 Factory.
- *
- * @return UserFactory
- */
- protected static function newFactory()
- {
- return UserFactory::new();
- }
- /**
- * 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 ['user'];
- }
- }
|