You can have a look at https://spatie.be/docs/laravel-permission/v5/introduction and see how they did it. It's basically the same thing you are trying to do and I don't know why you try to reinvent the wheel.
Blade::if('hasPermissionTo', function ($permission) {
return in_array($permission, $this->user_permissions);
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community