I have a variable, $permissions, which stores whatever permissions value the user has in the database in the view to be used in my if/elseif statement. For some reason though, they content will not load like I want it to. I have the variable echoed to make sure that it is coming through, and it is. Why are my sections not appearing properly?
@define $permissions = Auth::user()->permissions
@if ($permissions===1)
@yield('dist1')
@elseif ($permissions===2)
@yield('dist2')
@elseif ($permissions===3)
@yield('dist3')
@elseif ($permissions===4)
@yield('dist4')
@elseif ($permissions===5)
@yield('dist5')
@endif
@Define's code in my global.php is:
Blade::extend(function($value) {
return preg_replace('/\@define(.+)/', '<?php ${1}; ?>', $value);
});
When I echo {{ $permissions }} after logging in as a particular user it WILL echo the correct number. In the table I have the value set for "permissions" as an integer with a default of "0". Of the two users I am trying, one has a value of "2" and the other has a value of "0".