'datetime', ]; /** * Set permissions guard to API by default * @var string */ protected $guard_name = 'api'; /** * @inheritdoc */ public function getJWTIdentifier() { return $this->getKey(); } /** * @inheritdoc */ public function getJWTCustomClaims() { return []; } /** * @return bool * 验证是否管理员 */ public function isAdmin(): bool { foreach ($this->roles as $role) { if ($role->isAdmin()) { return true; } } return false; } }