Open abuzamanbd opened 5 years ago
@abuzamanbd the blade directive "@role" translates back to <?php if (\Entrust::hasRole({$expression})) : ?>
so in order to get the functionality you are requesting for, you will need to register a new blade directive in a service provider for it
Blade::directive('role', function($expression) {
return "<?php if (\\Entrust::hasRole{$expression}) : ?>";
});
Blade::directive('endrole', function($expression) {
return "<?php endif; // Entrust::hasRole ?>";
});
// Call to Entrust::can
Blade::directive('permission', function($expression) {
return "<?php if (\\Entrust::can{$expression}) : ?>";
});
Blade::directive('endpermission', function($expression) {
return "<?php endif; // Entrust::can ?>";
});
// Call to Entrust::ability
Blade::directive('ability', function($expression) {
return "<?php if (\\Entrust::ability{$expression}) : ?>";
});
Blade::directive('endability', function($expression) {
return "<?php endif; // Entrust::ability ?>";
});```
$expression = Array or String
Hi, I want to show some specific menu 2 users. But If I set like blew code it's not working. Can anyone have any suggestion, How can I set a menu for 2 different roles?