larapack/voyager-hooks

Add `browse_hooks` permission to Voyager

akazorg opened this issue · 10 comments

Hooks menu item is not being displayed because permission is missing.

(edit)
I've found out that menu item is being added on Voyager repo. We should be adding Menu + Permission from the same repo.
Ping @marktopper.

Solution

Add permission browse_hooks on Voyager and assign it to any existing admin on the system.

@imknight It didn't work
after making your suggested changes it still not working, actually returns this error:
php artisan voyager:hook-permission

In VoyagerHooksServiceProvider.php line 13:
                                                                               
  Parse error: syntax error, unexpected 'if' (T_IF), expecting function (T_FU  
  NCTION)                                                                      
                                                           

And I still can't make the hooks work.

I assume you might miss out the bracket, the simple way to solve this is just add "browse_hooks" permission without doing all these code change.

I'm new to laravel and voyager. It may sound silly but how I do add this "browse_hooks" permission?

Before doing all the changes to the code, I did run this code of yours "php artisan voyager:hook-permission", and it return that the variable hook-permission or hook-permissions, doesn't exist!

I assume you are using the voyager, which is why you are looking into voyager-hooks, like I say if you can't get the code work, just login voyager admin and add the browse_hooks permission

I'm also new to laravel and voyager. Running into the same problem. Like phillipsouza I simply don't know how to add the permission browse_hooks. Maybe you could explain, as after watching the permissions video as well as reading the voyager documentation I don't get it.
After fresh installation of laravel and voyager I did the steps shown here: https://github.com/larapack/voyager-hooks but got no hooks menu item. I don't see an option to add permissions in the admin role, nore do I see a hooks bread where I could add the permissions...

@robob2git I solved this through the database, just added the browse_hooks in the permission table directly into the db. Via voyager admin it just doesn't work. Only DB

@phillipesouza. Thank you. Works. :) The package commit from @imknight has a failure (has a if statement before the class and throws an failure). After moving that to boot function it works as well. But much simpler, for now, is indeed to add the browse_hooks to the permission table in the database manually...

As @phillipesouza said, you can just add the permission to the database directly (or through a migration or seed file). Alternatively, you could add BREAD to the permissions table and do it through Voyager's generated UI.

Hi @fletch3555, I tried that, add the BREAD into the permission table via Voyager UI, but it just didn't work.

Fixed in #14
Cleanup PR for Voyager sent as well to remove it from there.