mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-10-26 20:17:14 +01:00
Added canAccessPanel funtion to user model
This commit is contained in:
parent
553bbcceef
commit
f7a516ee05
1 changed files with 8 additions and 1 deletions
|
|
@ -9,8 +9,10 @@ use Illuminate\Notifications\Notifiable;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Filament\Models\Contracts\FilamentUser;
|
||||||
|
use Filament\Panel;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable implements FilamentUser
|
||||||
{
|
{
|
||||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||||
use HasFactory, Notifiable;
|
use HasFactory, Notifiable;
|
||||||
|
|
@ -27,6 +29,11 @@ class User extends Authenticatable
|
||||||
'is_admin'
|
'is_admin'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function canAccessPanel(Panel $panel): bool
|
||||||
|
{
|
||||||
|
return $this->is_admin === 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be hidden for serialization.
|
* The attributes that should be hidden for serialization.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue