I'm given with a task of adding new features in a built-in application and I end up with a piece of code. I have no idea how its working. On AppServiceProvider.php
Blade::directive('hasRole', function ($expression) {
$exp=explode(",",$expression);
return "<?php if(Auth::user()->hasPermission($exp[0],$exp[1])): ?>";
});
On blades:
@hasRole('travel_calendar','view')
<button class="btn btn-space btn-default btn-big tactive" id="travel_menu_cal" ><i class="icon mdi mdi-calendar"></i> Calendar</button>
@endHasRole
What does the view does in this code too. Someone place explain me the code.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire