38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Roles\Schemas;
|
|
|
|
use Filament\Forms\Components\CheckboxList;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Schemas\Components\Section;
|
|
use Spatie\Permission\Models\Permission;
|
|
|
|
class RoleForm
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make()
|
|
->schema([
|
|
TextInput::make('name')
|
|
->label(__('app.role_name'))
|
|
->required()
|
|
->maxLength(255)
|
|
->unique(ignoreRecord: true),
|
|
]),
|
|
|
|
Section::make(__('app.permissions'))
|
|
->description(__('app.permissions'))
|
|
->schema([
|
|
CheckboxList::make('permissions')
|
|
->label('')
|
|
->options(fn () => Permission::orderBy('name')->pluck('name', 'name')->toArray())
|
|
->columns(4)
|
|
->columnSpanFull(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|