user()->can('manage_roles') || auth()->user()->can('admin'); } protected static ?string $model = Role::class; protected static ?string $navigationIcon = 'heroicon-o-shield-check'; protected static ?string $navigationGroup = 'Ustawienia'; protected static ?string $modelLabel = 'Rola'; protected static ?string $pluralModelLabel = 'Role'; protected static ?int $navigationSort = 2; public static function form(Form $form): Form { return $form ->schema([ Forms\Components\Section::make('Informacje o roli') ->schema([ TextInput::make('name') ->label('Nazwa roli') ->required() ->maxLength(255) ->unique(ignoreRecord: true), Select::make('permissions') ->label('Uprawnienia') ->relationship('permissions', 'name') ->multiple() ->preload() ->searchable() ]) ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('name') ->label('Nazwa roli') ->searchable(), TextColumn::make('permissions.name') ->label('Uprawnienia') ->badge() ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListRoles::route('/'), 'create' => Pages\CreateRole::route('/create'), 'edit' => Pages\EditRole::route('/{record}/edit'), ]; } }