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


this question has answer here:

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

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -