killstreet
killstreet

Reputation: 1332

laravel resource route not generating named routes

So I just created a resource route as follow:

Route::group(['prefix' => 'control-panel'], function () {
   Route::resource('changelog', 'admin\ChangelogController');
});

Yet when I try and use any named route in blade it says that the route does not exits. Note that I do have a grouped - prefix route around it.

{{ route('changelog.create') }}

I really rather not write all routes seperate as I've done now for a quick fix. I use Laravel 5.2.

Upvotes: 0

Views: 621

Answers (1)

ClearBoth
ClearBoth

Reputation: 2325

You are using route prefix so the route name will have that prefix too. This must be working:

{{ route('control-panel.changelog.create') }}

you can override these names by passing a names array with your options:

Route::group(['prefix' => 'control-panel'], function () {

   Route::resource('changelog', 'admin\ChangelogController', ['names' => [
        'create' => 'changelog.create'
    ]]);

});

Upvotes: 3

Related Questions