Pass variables to multiple view in laravel
问题 I want to pass a variable to multiple view bu when i use share method in View. Its says the share method isn't find on View. How you say i use it and i try the composer either but no matter how i try it can't work could you give me simple example of this action My controller categorycontroller.php public function site(){ $data = array(); $data['subcategories'] = SubCategory::all(); $data['categories'] = Category::all(); return view('template.sitemap',compact("data")); } My route web.php Route