How to pass data to multiple view page in laravel using single controller function
I have three view template/blade files. and one controller View files: ———— side_bar.blade.php main_view.blade.php dashboardhome.blade.php here side_bar.blade.php and main_view.blade.php included to dashboardhome.blade.php Controller files: —————— displaydashboard function will redirect to dashboardhome.blade.php page with one array of data passed to side_bar.blade.php and other array of data passing to main_view.blade.php dashboardcontroller.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php public function displaydashboard() { $emp_details=somearray(); $kids_details=somearray(); View::composer('dashboard.side_bar', function($view) use ($emp_details) { return $view->with('emp_details', $emp_details); }); return view('dashboard.dashboardhome', $kids_details); } ?> |