In my routing if i remove the {page} prefix it works completely fine but when i put it i get an error. For other it is working fine but it is not working for this route: Route::
It seems we need to pass $page
parameter in the CostIncludesController
. This same question is answered in this post:
I am having trouble with my route in laravel
In your CostIncludeController@index, add the new variable. The router is expecting you to handle two variables.
public function index($page, $categories){
$pages = Page::all();
$packages = Package::where('slug',$categories)->first();
return view('admin.pages.costinclude',[
'packages' => $packages,
],compact('pages'));
}
You can confirm the cause of the error by doing a dd($categories)
inside your controller function in both cases.