Named restful routes in Laravel 4

前端 未结 3 1249
情话喂你
情话喂你 2021-02-03 15:45

So, I\'ve been able to get restful controllers working with

Route::controller(\'users\',\'UserController\');

class UserController extends BaseController {
    p         


        
3条回答
  •  忘了有多久
    2021-02-03 16:13

    This would depend entirely on the order you have defined the routes. If it's not working try reversing the order of the definitions.

    But because Laravel is all about making your life easier you can pass an array of method names and their corresponding route name as the third parameter to Route::controller.

    Route::controller('users', 'UsersController', ['getProfile' => 'user.profile']);
    

    This might not directly apply to your situation but it is super handy.

提交回复
热议问题