LoginSignup
0

More than 3 years have passed since last update.

LaravelのRoute::resourceにルートパラメータを指定する方法

Posted at

公式ドキュメントになさそうで、試してみないとわからなかったのでメモ。

実装

Route::resource('posts', PostController::class)
Route::resource('posts/{post}/comments', CommentController::class)

Route::resourceも他のルーターメソッドと同じ感じにルートパラメータが使えました。

参考

ルーティング 8.x (再翻訳中)Laravel
https://readouble.com/laravel/8.x/ja/routing.html

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0