i was create route resource and i use {post:slug} for route model binding but in some method for example update method, i want to use {post:id} for route model binding and keep the other method to use {post:slug}
How to implement it? Is it possible to add multiple scope
this is my code
Route::resource('/dashboard/posts', DashboardPostController::class)->scoped(['post' => 'slug']);
CodePudding user response:
First, you need to use resources without update:
Route::resource('/dashboard/posts', DashboardPostController::class)->scoped(['post', 'slug'])->except('update');
and then:
Route::put('dashboard/posts/{posts:id}, [ DashboardPostController::class => 'update');