Skip to content

A free open source IT asset/license management system

Update custom asset report url and redirect old url

Marcus Moorec14cd27f2f7b
diff --git a/routes/web.php b/routes/web.php
index 068dd8c406..248ce38ad1 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -455,6 +455,9 @@ Route::group(['middleware' => ['auth']], function () {
Route::post('notes', [NotesController::class, 'store'])->name('notes.store');
});
+// leading / is intentional:
+Route::redirect('/reports/custom', '/reports/custom/assets');
+
Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () {
Route::get('audit', [ReportsController::class, 'audit'])
@@ -501,7 +504,7 @@ Route::group(['prefix' => 'reports', 'middleware' => ['auth']], function () {
Route::get('export/accessories', [ReportsController::class, 'exportAccessoryReport'])
->name('reports/export/accessories');
- Route::get('custom', [ReportsController::class, 'getCustomReport'])
+ Route::get('custom/assets', [ReportsController::class, 'getCustomReport'])
->name('reports/custom')
->breadcrumbs(fn (Trail $trail) => $trail->parent('home')
->push(trans('general.custom_report'), route('reports/custom')));
@@ -733,3 +736,5 @@ Route::middleware(['auth'])->get(
)->name('home')
->breadcrumbs(fn (Trail $trail) => $trail->push('Home', route('home'))
);
+
+// Route::redirect('/reports/custom', '/reports/custom/assets');
diff --git a/tests/Feature/Reporting/Custom/CustomAssetReportTest.php b/tests/Feature/Reporting/Custom/CustomAssetReportTest.php
index dca8fb83b4..caf13e8b0d 100644
--- a/tests/Feature/Reporting/Custom/CustomAssetReportTest.php
+++ b/tests/Feature/Reporting/Custom/CustomAssetReportTest.php
@@ -57,6 +57,13 @@ class CustomAssetReportTest extends TestCase implements TestsPermissionsRequirem
->assertForbidden();
}
+ public function test_redirects_old_url_to_new_url()
+ {
+ $this->actingAs(User::factory()->canViewReports()->create())
+ ->get('/reports/custom')
+ ->assertRedirect('/reports/custom/assets');
+ }
+
public function test_can_load_custom_report_page()
{
$this->actingAs(User::factory()->canViewReports()->create())