I'm trying to add default parameter to resource routing as per documentation:
My code looks like:
Route::resource('flats', FlatsController::class)->parameters([
'index' => 'test_parameter',
'create' => 'test_parameter1',
'update' => 'test_parameter2'
]);
But unfortunately all the time when listing the routing it gets like in the screenshot below:
Please help guide at what point do I make a mistake?
You have the following:
| Methods | route |
|-----------|-------------------------------------|
| POST | panel/investments/flats |
| GET/HEAD | panel/investments/flats |
| GET/HEAD | panel/investments/flats/create |
| GET/HEAD | panel/investments/flats/{flat} |
| PUT/PATCH | panel/investments/flats/{flat} |
| DELETE | panel/investments/flats/{flat} |
| GET/HEAD | panel/investments/flats/{flat}/edit |
Since the only parameter is {flat}
you can only rename this one as per docs:
Route::resource('flats', FlatsController::class)->parameters([
'flat' => 'apartment'
]);
This results in:
| Methods | route |
|-----------|------------------------------------------|
| POST | panel/investments/flats |
| GET/HEAD | panel/investments/flats |
| GET/HEAD | panel/investments/flats/create |
| GET/HEAD | panel/investments/flats/{apartment} |
| PUT/PATCH | panel/investments/flats/{apartment} |
| DELETE | panel/investments/flats/{apartment} |
| GET/HEAD | panel/investments/flats/{apartment}/edit |