Support the ongoing development of Laravel.io →
posted 6 years ago
Requests
Last updated 1 year ago.
0
moderator Solution

The . suspect that it are 2 nested resources. (See php artisan route:list )

If you use the / Route::resource('chalk/board', 'ChalkboardController'); You will see that you have a chalk/board url with the name board.index.

If you want to have the chalk.board.index as name as well the other names you have multiple options:

1: use the names function:

Route::resource('chalk/board', 'ChalkboardController')->names([  
    'index' => 'chalk.board.index',  
    'store' => 'chalk.board.store',  
    // and the create, update, show, destroy and edit  
]);

2: Use the name function for each route:

Route::resource('chalk/board', 'ChalkboardController')  
    ->name('index', 'chalk.board.index')  
    ->name('store', 'chalk.board.store')  
    // and the create, update, show, destroy and edit  
;

3: Put it in a group with a name:

Route::name('chalk.')->group(function () {
    Route::resource('chalk/board', 'ChalkboardController');
});
Last updated 6 years ago.
0

I couldn't find any similar nested routes so it could be a bug? I'm going to go with the route names anyway, I didn't know re-naming resources was so easy, thanks!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

RexT4 rext4 Joined 2 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.