I'm confused, which is it you are talking about, the resource route or theRoute::get('{menu}/', route
By the way, this one will catch all routes so must be LAST in your routes file
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i did not understand where I make a mistake. can anyone solve this problem?
This is my route
Route::get('{menu}/', 'contentviewController@show');
This is my controller file where I calling the route
public function show($slug)
{
//
//$content = Content::find($id);
// $content = Content::where('slug', $slug)->first();
$content = Content::where('slug', $slug)->first();
$count = $content->view_count;
$count = $count+1;
$content->view_count = $count;
$content->save();
/*
return view('viewcontent.index',compact('content'));
*/
return view('theme1.viewcontent.index',compact('content'));
}
But problem is that when I go to the admin panel and access this route http://127.0.0.1:8000/menu this will give an errors.
Route::resource('menu','MenuController',
['names'=>[
'index'=>'admin_menu',
'create'=>'admin_menucreate',
'edit'=>'admin_menu_edit'
]
]);
Please or to participate in this conversation.