51 lines
934 B
PHP
51 lines
934 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Filament\Models\Contracts\FilamentUser;
|
|
use Filament\Panel;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
class User extends Authenticatable implements FilamentUser
|
|
{
|
|
use Notifiable;
|
|
|
|
protected $fillable = [
|
|
'id',
|
|
'name',
|
|
'email',
|
|
'password',
|
|
'role',
|
|
'is_active',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'id' => 'string',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function canAccessPanel(Panel $panel): bool
|
|
{
|
|
return (bool) $this->is_active;
|
|
}
|
|
|
|
public function isAdmin(): bool
|
|
{
|
|
return $this->role === 'admin';
|
|
}
|
|
|
|
public function isOperator(): bool
|
|
{
|
|
return $this->role === 'operator';
|
|
}
|
|
}
|