lundi 28 mai 2018

Laravel 5.5 autoload a function for each page without calling that function for each controller

I'm going to create a dynamic left navigation (menu) for each users. I have already created the database table for the same. Also, I have generated the menu structure based on the user logged in. The Left navigation is located as partial view (leftnav.blade.php). I'm currently passing the left nav data (generated from database values) to the view as like:

$data['tree'] = $this->generateSiteTree(0); // left nav generated
$data['bla] = 'bla bla etc';
return view('Administrator.permission.index', $data);

But, I do not want to generate the menu structure for each page individually by writing the same code again for another controller. I know how to create Helper function. My question is - how to automatically call the function for each page?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GXZj3A
via IFTTT

Aucun commentaire:

Enregistrer un commentaire