Give your routes names
Route::get('/customers', 'index')->name('customers.index')';
Or use a resource instead of individual routes
Route::resource('/customers');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a set of routes in my web.php file:
Route::name('resources.')->group(function () {
//* Customers' routes
Route::controller(CustomersController::class)->group(function () {
Route::get('/customers', 'index');
Route::get('/customers.create', 'create');
Route::get('/customers.{customer}.edit', 'edit');
Route::delete('/customers.{customer}.destroy', 'destroy');
});
});
But I keep getting this error in my console Uncaught Error: Ziggy error: route 'resources.customers.index' is not in the route list.. Indeed, when I check with console.log(Ziggy.routes) it doesn't exist, and I don't know why. In my frontend Authenticated.js file, I have a link with the route route('resources.customers.index'). I don't know what I'm doing wrong.
@Sinnbeck I figured it out. The problem was mine. This is what I came up with:
Route::name('resources.')->group(function () {
//* Customers' routes
Route::controller(CustomersController::class)->group(function () {
Route::get('/customers', 'index')->name('customers.index');
Route::get('/customers.create', 'create')->name('customers.create');
Route::get('/customers.{customer}.edit', 'edit')->name('customers.edit');
Route::delete('/customers.{customer}.destroy', 'destroy')->name('customers.destroy');
});
});
Before, I had included a slash in the ->name('/customers.index') route and I did not see clearly that in route::list it gave me resources./customers.index'. So Ziggy wasn't identifying the route resources.cusomers.index that I specified.
Just see how a small issue can cause hours of headache. haha!
Please or to participate in this conversation.