Files
sembara/app/Models/User.php
T

50 lines
904 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 [
'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';
}
}