You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
1.8 KiB
89 lines
1.8 KiB
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Tymon\JWTAuth\Contracts\JWTSubject;
|
|
|
|
/**
|
|
* App\Manager
|
|
*
|
|
*/
|
|
class Worker extends Authenticatable implements JWTSubject
|
|
{
|
|
use Notifiable;
|
|
|
|
protected $table = "paramedic";
|
|
|
|
const GUARD_NAME = "worker";
|
|
|
|
public function getAvatarUrlAttribute()
|
|
{
|
|
$protocol = request()->secure() ? "https" : "http";
|
|
if (!$this->avatar) {
|
|
switch ($this->sex) {
|
|
case "男":
|
|
$this->avatar = "/images/male.png";
|
|
break;
|
|
case "女":
|
|
$this->avatar = "/images/female.png";
|
|
break;
|
|
}
|
|
}
|
|
return $this->avatar ? $protocol . "://" . request()->getHost() . $this->avatar : $this->avatar;
|
|
}
|
|
|
|
public function guardName()
|
|
{
|
|
return self::GUARD_NAME;
|
|
}
|
|
|
|
// 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 [];
|
|
}
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [];
|
|
|
|
/**
|
|
* 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 = [
|
|
'verified_at' => 'datetime',
|
|
];
|
|
}
|