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.
46 lines
897 B
46 lines
897 B
|
1 month ago
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||
|
|
use Laravel\Sanctum\HasApiTokens;
|
||
|
|
|
||
|
|
class AdminUser extends Authenticatable
|
||
|
|
{
|
||
|
|
use HasApiTokens, HasFactory;
|
||
|
|
|
||
|
|
protected $table = 'admin_users';
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'mobile',
|
||
|
|
'username',
|
||
|
|
'password_hash',
|
||
|
|
'name',
|
||
|
|
'status',
|
||
|
|
'last_login_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $hidden = [
|
||
|
|
'password_hash',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @var array<string, string>
|
||
|
|
*/
|
||
|
|
protected $casts = [
|
||
|
|
'last_login_at' => 'datetime',
|
||
|
|
'password_hash' => 'hashed',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function getAuthPassword(): ?string
|
||
|
|
{
|
||
|
|
return $this->password_hash;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function usesPassword(): bool
|
||
|
|
{
|
||
|
|
return $this->password_hash !== null && $this->password_hash !== '';
|
||
|
|
}
|
||
|
|
}
|