I made a custom conditional directive to determine if a user is allowed or not by the role.
Blade::if('isAllow', function($type, $my_role_id) {
//dd($type, $my_role_id);
$rol = Role::where('name', $type)->first();
return $my_role_id == $rol->id? true : false;
});
I use it this way.
@isAllow('Requestor', Auth()->user()->role_id) All @elseisAllow Reviewed @endisAllow
If into the directive, I do a dd() to see the values, it shows them to me without much problem.
But, when I want to use it in the template, it shows me the following error:
Too few arguments to function AppProvidersAppServiceProvider::AppProviders{closure}(), 0 passed and exactly 2 expected
I can’t find a solution to explain me why is not getting any param when it does. Any help?
