To make sure a route isnt captured by a previous, try moving the group that isnt working to the top of the admin group
Problem with routes
Hey!
I have the following structure of my routes/web.php

and each group has routes like index, add, edit, delete etc...
// ...
// News
Route::name('news.')->prefix('news')->group(function() {
Route::name('index')->get('/', [AdminController::class, 'newsIndex']);
Route::name('add')->get('/', [AdminController::class, 'newsAdd']);
Route::name('edit')->get('/', [AdminController::class, 'newsEdit']);
// ....
});
// ...
But unfortunately I faced some problems. Last 2 group creations which are actually the sources. and ads. groups, some of the routes inside these groups are not correctly handled by Laravel because their route names are actually bugging. Example: The current bug I'm facing is inside the News Source Group:
// News Sources
Route::name('sources.')->prefix('news/sources')->middleware('onlyAdministrators')->group(function() {
Route::name('index')->get('/', [AdminController::class, 'newsSourcesIndex']);
Route::name('add')->get('/add', [AdminController::class, 'newsSourcesAdd']);
});
as you can see I'm having 2 routes which must correspond to admin.sources.index and admin.sources.add but Laravel is returning me an error Route [admin.sources.add] not defined. when trying to put a link to this route inside a <a href="{{ route('admin.sources.add') }}"> tag. I tried clearing all the possible caches through arisan commands.
php artisan config:clear
php artisan route:clear
php artisan view:clear
php artisan view:cache
php artisan event:clear // which actually has nothing to do with this problem
php artisan optimize:clear
php artisan optimize
php artisan cache:clear
but inside the route:list the admin.sources.add route is still with a route name of admin.sources.. What might be the problem? I'm really stuck.
Use a that way
Route::get('/add', [AdminController::class, 'newsSourcesAdd'])->name('add');
Please or to participate in this conversation.