Laravel route ---- resoure
Posted 纭卿殇
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Laravel route ---- resoure相关的知识,希望对你有一定的参考价值。
Laravel 路由--资源路由
Route::resource(‘blog‘, ‘BlogController‘);
上面代码将等同于:
Route::get(‘/blog‘, ‘[email protected]‘)->name(‘blog.index‘);
Route::get(‘/blog/{id}‘, ‘[email protected]‘)->name(‘blog.show‘);
Route::get(‘/blog/create‘, ‘[email protected]‘)->name(‘blog.create‘);
Route::post(‘/blog‘, ‘[email protected]‘)->name(‘blog.store‘);
Route::get(‘/blog/{id}/edit‘, ‘[email protected]‘)->name(‘blog.edit‘);
Route::patch(‘/blog/{id}‘, ‘[email protected]‘)->name(‘blog.update‘);
Route::delete(‘/blog/{id}‘, ‘[email protected]‘)->name(‘blog.destroy‘);
按照RESTful 架构对路由进行设计。
以上是关于Laravel route ---- resoure的主要内容,如果未能解决你的问题,请参考以下文章
Laravel - Route::resource 与 Route::controller
laravel 5 - 在 routes.php 末尾捕获所有路由(Route::controller)?