Routing Error Due to a group prefix in my route

前端 未结 2 802
北海茫月
北海茫月 2021-01-29 11:08

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::

相关标签:
2条回答
  • 2021-01-29 11:42

    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

    0 讨论(0)
  • 2021-01-29 11:43

    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.

    0 讨论(0)
提交回复
热议问题