Q:

How Can I return two variables from same method/function to one view in laravel 5.4?

I'm  a beginner with Laravel 5.4 but I'm stuck at some point. Please tell me how can I return two variables from one function / method to the same view. I've googled but all the contents are so old!!!
Here is my controller
public function index(Request $fetch){
      $category = Category::all();
      $fetch_cat = Category::find($fetch)->first();
      //$data = array('category' => $category, 'fetch_cat'=> $fetch_cat);
      return view('admin/create-menu', compact('data'));
}

I know I need to edit only this function and then in view I'll handle them. 

A:

You can do it like this:
$data = array('category' => $category, 'fetch_cat'=> $fetch_cat);
return view('admin/create-menu', $data);

or
return view('admin/create-menu', compact('category', 'fetch_cat'));

