From f8503d917a176b79ddfe204a740cdd1e36e7668e Mon Sep 17 00:00:00 2001 From: Raj Siva-Rajah <5361908+binaryfire@users.noreply.github.com> Date: Fri, 14 Mar 2025 09:15:25 +0000 Subject: [PATCH 1/5] Add configurable prefix to import and export routes --- packages/actions/routes/web.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/actions/routes/web.php b/packages/actions/routes/web.php index 5b7942860f..68ea4fa585 100644 --- a/packages/actions/routes/web.php +++ b/packages/actions/routes/web.php @@ -4,10 +4,12 @@ use Filament\Actions\Exports\Http\Controllers\DownloadExport; use Filament\Actions\Imports\Http\Controllers\DownloadImportFailureCsv; use Illuminate\Support\Facades\Route; -Route::get('/filament/exports/{export}/download', DownloadExport::class) +$prefix = config('filament.utility_route_prefix', 'filament'); + +Route::get("/{$prefix}/exports/{export}/download", DownloadExport::class) ->name('filament.exports.download') ->middleware('filament.actions'); -Route::get('/filament/imports/{import}/failed-rows/download', DownloadImportFailureCsv::class) +Route::get("/{$prefix}/imports/{import}/failed-rows/download", DownloadImportFailureCsv::class) ->name('filament.imports.failed-rows.download') ->middleware('filament.actions'); From 0f9b7c1b332f66f7ccaf0bd4d0034d85aa402772 Mon Sep 17 00:00:00 2001 From: Raj Siva-Rajah <5361908+binaryfire@users.noreply.github.com> Date: Fri, 14 Mar 2025 09:17:31 +0000 Subject: [PATCH 2/5] Refactor to route group --- packages/actions/routes/web.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/actions/routes/web.php b/packages/actions/routes/web.php index 68ea4fa585..65f6a881af 100644 --- a/packages/actions/routes/web.php +++ b/packages/actions/routes/web.php @@ -6,10 +6,13 @@ use Illuminate\Support\Facades\Route; $prefix = config('filament.utility_route_prefix', 'filament'); -Route::get("/{$prefix}/exports/{export}/download", DownloadExport::class) - ->name('filament.exports.download') - ->middleware('filament.actions'); +Route::middleware('filament.actions') + ->name('filament.') + ->prefix($prefix) + ->group(function () { + Route::get("/exports/{export}/download", DownloadExport::class) + ->name('exports.download'); -Route::get("/{$prefix}/imports/{import}/failed-rows/download", DownloadImportFailureCsv::class) - ->name('filament.imports.failed-rows.download') - ->middleware('filament.actions'); + Route::get("/imports/{import}/failed-rows/download", DownloadImportFailureCsv::class) + ->name('imports.failed-rows.download'); + }); From c0e02b4bf36112615803136422bcae5e2038a33b Mon Sep 17 00:00:00 2001 From: Raj Siva-Rajah <5361908+binaryfire@users.noreply.github.com> Date: Fri, 14 Mar 2025 09:28:28 +0000 Subject: [PATCH 3/5] Update config file --- packages/support/config/filament.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/support/config/filament.php b/packages/support/config/filament.php index 65b4bf0e82..8318b47119 100644 --- a/packages/support/config/filament.php +++ b/packages/support/config/filament.php @@ -86,4 +86,16 @@ return [ 'livewire_loading_delay' => 'default', + /* + |-------------------------------------------------------------------------- + | Utility Route Prefix + |-------------------------------------------------------------------------- + | + | This is the prefix used for the utility routes that Filament registers, + | such as the routes for downloading exports and failed import rows. + | + */ + + 'utility_route_prefix' => 'filament', + ]; From e63bdca185b000cbd2ced03d0e998edb8188a9b6 Mon Sep 17 00:00:00 2001 From: Raj Siva-Rajah <5361908+binaryfire@users.noreply.github.com> Date: Thu, 20 Mar 2025 10:14:13 +0000 Subject: [PATCH 4/5] Rename config key from utility_ to system_ --- packages/actions/routes/web.php | 2 +- packages/support/config/filament.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/actions/routes/web.php b/packages/actions/routes/web.php index 65f6a881af..d070e7ba81 100644 --- a/packages/actions/routes/web.php +++ b/packages/actions/routes/web.php @@ -4,7 +4,7 @@ use Filament\Actions\Exports\Http\Controllers\DownloadExport; use Filament\Actions\Imports\Http\Controllers\DownloadImportFailureCsv; use Illuminate\Support\Facades\Route; -$prefix = config('filament.utility_route_prefix', 'filament'); +$prefix = config('filament.system_route_prefix', 'filament'); Route::middleware('filament.actions') ->name('filament.') diff --git a/packages/support/config/filament.php b/packages/support/config/filament.php index 8318b47119..488a01f073 100644 --- a/packages/support/config/filament.php +++ b/packages/support/config/filament.php @@ -88,14 +88,14 @@ return [ /* |-------------------------------------------------------------------------- - | Utility Route Prefix + | System Route Prefix |-------------------------------------------------------------------------- | - | This is the prefix used for the utility routes that Filament registers, + | This is the prefix used for the system routes that Filament registers, | such as the routes for downloading exports and failed import rows. | */ - 'utility_route_prefix' => 'filament', + 'system_route_prefix' => 'filament', ]; From 734a1c60035e2b35d28848ca9cd75f739ada58ca Mon Sep 17 00:00:00 2001 From: binaryfire Date: Mon, 31 Mar 2025 08:11:38 +0000 Subject: [PATCH 5/5] chore: fix code style --- packages/actions/routes/web.php | 4 ++-- .../resources/views/components/selection/indicator.blade.php | 4 +++- tests/src/Panels/Resources/Pages/EditRecordTest.php | 2 +- tests/src/Panels/Resources/Pages/ListRecordsTest.php | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/actions/routes/web.php b/packages/actions/routes/web.php index d070e7ba81..16f8f5df46 100644 --- a/packages/actions/routes/web.php +++ b/packages/actions/routes/web.php @@ -10,9 +10,9 @@ Route::middleware('filament.actions') ->name('filament.') ->prefix($prefix) ->group(function () { - Route::get("/exports/{export}/download", DownloadExport::class) + Route::get('/exports/{export}/download', DownloadExport::class) ->name('exports.download'); - Route::get("/imports/{import}/failed-rows/download", DownloadImportFailureCsv::class) + Route::get('/imports/{import}/failed-rows/download', DownloadImportFailureCsv::class) ->name('imports.failed-rows.download'); }); diff --git a/packages/tables/resources/views/components/selection/indicator.blade.php b/packages/tables/resources/views/components/selection/indicator.blade.php index bebe5b19f5..573efbb2dc 100644 --- a/packages/tables/resources/views/components/selection/indicator.blade.php +++ b/packages/tables/resources/views/components/selection/indicator.blade.php @@ -34,7 +34,9 @@ $post->getKey(), ]) ->callAction('randomize_title'); diff --git a/tests/src/Panels/Resources/Pages/ListRecordsTest.php b/tests/src/Panels/Resources/Pages/ListRecordsTest.php index fc5099c36a..c7ecc24b4e 100644 --- a/tests/src/Panels/Resources/Pages/ListRecordsTest.php +++ b/tests/src/Panels/Resources/Pages/ListRecordsTest.php @@ -123,7 +123,7 @@ test('table actions will not interfere with database transactions on an error', $transactionLevel = DB::transactionLevel(); try { - livewire(PostResource\Pages\ListPosts::class) + livewire(ListPosts::class) ->callTableAction('randomize_title', $post); } catch (Exception $e) { // This can be catched and handled somewhere else, code continues...