Route::get("/product/{chpu}-{id}",[\App\Http\Controllers\ProductController::class,'view'])->name('product');
public function view(Request $request, $chpu, $id){
$product = Product::with('promotion')->where(
[
['chpu', '=', $chpu],
['id', '=', $id]
]
)->first();
return view('Client.product', [
'product' => $product,
]);
}
Route::controller(PostController::class)->prefix('blog')->name('blog.')->group(function (){
...
Route::get('{id}-{alias}', 'show')->name('show');
...
});
public function show($id, $alias)
{
$post = Post::with('comments')->where(['id' => $id, 'alias' => $alias])->firstOrFail();
return view(config('cms.theme').'.posts.show', ['post' => $post]);
}