【发布时间】:2021-06-17 01:40:32
【问题描述】:
当我使用 http://localhost:8000/books/create 时,我的“创建”路由总是产生 404 错误
我的路由/web.php 文件包含:
Route::middleware('role:adm|user')->group(function () {
Route::get('books', 'BooksController@index')->name('books.index');
Route::get('books/{book}', 'BooksController@show')->name('books.show');
Route::get('books/{book}/edit', 'BooksController@edit')->name('books.edit');
Route::put('books/{book}', 'BooksController@update')->name('books.update');
});
Route::middleware('role:adm')->group(function () {
Route::get('/books/create', 'BooksController@create')->name('books.create');
Route::post('books', 'BooksController@store')->name('books.store');
Route::delete('books/{book}', 'BooksController@destroy')->name('books.destroy');
});
奇怪的是,如果我删除 'show' 路由,'create' 路由会正常工作
提前谢谢你
【问题讨论】:
标签: laravel routes http-status-code-404