Search code examples
phplaravellaravel-5.3

Laravel 5.3 Resource routes names


I upgraded my Laravel 5.2 application to Laravel 5.3. I have a lot of Resource routes like:

Route::resource('web/products', 'Web\ProductController', ['except' => ['show']]);
Route::resource('web/promos',   'Web\PromoController',   ['except' => ['show']]);

The route names generated for them until Laravel 5.2 were:

web.products.index
web.products.create
web.products.store
web.products.edit
web.products.update
web.products.edit

I used the route() helper to print all the routes by its name. The problem is that now Laravel 5.3 is generating my routes with this names:

products.index
products.create
products.store
products.edit
products.update
products.edit

I need them to be fully namespaced.


Solution

  • I solved it this way:

    Route::resource('web/products', 'Web\ProductController', ['names' => [
        'create' => 'web.products.create'
    ]]);