php - How Can I return two variables from same method/function to one view in laravel 5.4? -
this question has answer here:
- laravel - pass more 1 variable view 5 answers
i'm beginner laravel 5.4 i'm stuck @ point. please tell me how can return 2 variables 1 function / method same view. i've googled contents old!!!
here 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 need edit function , in view i'll handle them.
you can 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'));
Comments
Post a Comment