I have the following scenario: Some types of users may have access to the site, say USERTYP1, USERTYP2 or USERTYP3.
The menu of my application changes according to the type of user.
I have a master template homeMaster.blade.php
and the menu was created in the home.blade.php
file that inherits the master template.
In traditional php should have if
in home.blade.php
to test a $usertype
variable. According to the type we would have the appropriate menu.
I was reading the blade documentation and created this code to test the user:
@if ($usertype === "USERTYP1")
menu 1
@elseif ($usertype === "USERTYP2")
menu 2
@else
menu 3
@endif
I did not understand how to pass this variable $usertype
to home.blade.php
, or even if this would be the best approach for this type of implementation.
-
Updating
I'll post here for anyone who needs it. I found a link that exactly answers my question.