Laravel named route for resource controller

后端 未结 7 1177
一向
一向 2020-11-30 22:09

Using Laravel 4.2, is it possible to assign a name to a resource controller route? My route is defined as follows:

Route::resource(\'faq\', \'ProductFaqCont         


        
7条回答
  •  醉话见心
    2020-11-30 23:07

    I don't know if it's available in laravel 4.2 (I tested in 5.7) but you can use names to change the name of all routes generated by resource

    Route::resource('faq', 'ProductFaqController', ['names' => 'something']);
    

    and the result will be like this

    something.index
    

    and you don't need to specify each route

提交回复
热议问题