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.
37 lines
729 B
37 lines
729 B
<?php
|
|
|
|
use App\Domains\Identity\Models\Role;
|
|
use App\Livewire\Concerns\WithModal;
|
|
use Livewire\Attributes\Computed;
|
|
use Livewire\Attributes\Locked;
|
|
use Livewire\Component;
|
|
use Spatie\Permission\Contracts\Role as SpatieRole;
|
|
|
|
new class extends Component
|
|
{
|
|
use WithModal;
|
|
|
|
#[Locked]
|
|
public ?string $id = null;
|
|
|
|
#[Locked]
|
|
public string $mode = 'view';
|
|
|
|
protected string $resourceName = 'role';
|
|
|
|
#[Computed]
|
|
public function role(): SpatieRole
|
|
{
|
|
return $this->id ? Role::with('permissions')->findOrFail($this->id) : new Role;
|
|
}
|
|
|
|
public function show(int|string $id): void
|
|
{
|
|
$this->id = $id;
|
|
}
|
|
|
|
public function hide(): void
|
|
{
|
|
$this->reset();
|
|
}
|
|
};
|
|
|