0

I need to generate differents menus for my application when login depending on the user role. In order to do this, I need to extract some information from database.

I think the better solution is to code after login the generation of html for the menu and save it on a session variable. Then in my layout i only have to put that session variable and don't have to repeat all the code in all pages.

Am I right?

Where is the better place for coding this?

Thanks!

Jaime
  • 328
  • 1
  • 6
  • 19
  • try this: https://stackoverflow.com/questions/29715813/laravel-5-global-blade-view-variable-available-in-all-templates – shushu304 Apr 13 '19 at 08:01
  • put the menus in a separate folder and include them as per the users. Like if app()->user->isBlaBla then include('balbla-menu') or use a switch statement. – f_i Apr 13 '19 at 08:55
  • Two interesting approach. I will check both. Thanks! – Jaime Apr 15 '19 at 16:22

0 Answers0