以下是两者都执行时发生的路由:
Route::controller('test', 'TestController');
Route::resource('othertest', 'OtherTestController');
如果更容易的话,这是我将要以文字形式为您写出的图片:
以下是多合一的。例如,如果您将GET 转换为laravel_dir/test/page,它将在TestController 中查找方法getPage()。如果你 POST 到 laravel_dir/test/page,它将寻找 postPage()
URI:GET|HEAD|POST|PUT|PATCH|DELETE 测试/{_missing}
路线名称:无
动作:TestController@missingMethod
以下是资源路由的结果...您会发现它对您的 routes.php 文件的一行中的 CRUD 非常有用。
URI:GET|HEAD othertest
路线名称:othertest.index
动作:OtherTestController@index
URI:GET|HEAD othertest/create
路线名称:othertest.create
动作:OtherTestController@create
URI:POST othertest
路线名称:othertest.store
动作:OtherTestController@store
URI:GET|HEAD othertest/{othertest}
路线名称:othertest.show
动作:OtherTestController@show
URI:GET|HEAD othertest/{othertest}/edit
路线名称:othertest.edit
动作:OtherTestController@edit
URI:PUT othertest/{othertest}
路线名称:othertest.update
动作:OtherTestController@update
URI:PATCH othertest/{othertest}
Route Name:othertest.update(与上面同名)
动作:OtherTestController@update
URI:删除其他测试/{othertest}
路线名称:othertest.destroy
动作:OtherTestController@destroy