components([ FileUpload::make('badge_file') ->label('Upload Badge') ->disk('local') ->directory(setting('badge_path_filesystem')) ->required() ->getUploadedFileNameForStorageUsing( fn (TemporaryUploadedFile $file): string => strtolower(str_replace([' ', '-', 'æ', 'ø', 'å'], ['_', '_', 'ae', 'oe', 'aa'], $file->getClientOriginalName())), ), ]); } #[\Override] public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('filename') ->label('File Name') ->sortable(), TextColumn::make('path') ->label('File Path'), ]) ->filters([]); } #[\Override] public static function getPages(): array { return [ 'index' => ManageBadgeUploads::route('/'), ]; } public static function getFiles(): array { $badgePath = env('BadgePath', 'badges'); $files = Storage::disk('local')->files($badgePath); return collect($files)->map(fn ($file) => [ 'filename' => basename($file), 'path' => $file, ])->toArray(); } }