components([ Section::make('User Details') ->components([ TextInput::make('name') ->label(__('filament.resource.user.form.name')) ->required() ->maxLength(255), TextInput::make('email') ->label(__('filament.resource.user.form.email')) ->email() ->required() ->maxLength(255), TextInput::make('password') ->label(__('filament.resource.user.form.password')) ->password() ->dehydrateStateUsing(fn (string $state): string => bcrypt($state)) ->dehydrated(fn (?string $state): bool => filled($state)) ->required(fn (string $operation): bool => $operation === 'create') ->maxLength(255), TextInput::make('admin_pin_hash') ->label('Admin PIN') ->password() ->revealable() ->dehydrateStateUsing(fn (?string $state): ?string => filled($state) ? bcrypt($state) : null) ->dehydrated(fn (?string $state): bool => filled($state)) ->afterStateHydrated(function (TextInput $component): void { $component->state(null); }) ->nullable() ->rule('regex:/^\\d+$/') ->minLength(4) ->maxLength(8) ->helperText('Leave blank to keep the current PIN.'), Select::make('role_id') ->label(__('filament.resource.user.form.role')) ->relationship('role', 'name') ->required(), ])->columns(2) ->columnSpanFull(), Section::make('Preferences') ->components([ Toggle::make('email_notifications_enabled') ->label(__('filament.resource.user.form.email_notifications_enabled')) ->default(true), Select::make('theme_preference') ->label(__('filament.resource.user.form.theme_preference')) ->options([ 'light' => __('filament.resource.user.form.theme_light'), 'dark' => __('filament.resource.user.form.theme_dark'), ]) ->default('light'), Select::make('locale') ->label(__('filament.resource.user.form.locale')) ->options([ 'en' => 'English', 'de' => 'Deutsch', ]) ->default('en'), ])->columns(2) ->columnSpanFull(), ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('name')->searchable()->sortable(), TextColumn::make('email')->searchable()->sortable(), TextColumn::make('role.name')->searchable()->sortable(), ]) ->filters([ // ]) ->actions([ EditAction::make(), ]) ->bulkActions([ BulkActionGroup::make([ DeleteBulkAction::make(), ]), ]) ->emptyStateActions([ CreateAction::make(), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListUsers::route('/'), 'create' => Pages\CreateUser::route('/create'), 'edit' => Pages\EditUser::route('/{record}/edit'), ]; } public static function getNavigationGroup(): ?string { return __('filament.navigation.groups.user_management'); } public static function getNavigationLabel(): string { return __('filament.navigation.users'); } }