Skip to content

How to set admin role to have access in viewing and deleting log? #91

Answered by arukompas
anonymouse703 asked this question in Q&A
Discussion options

You must be logged in to vote

Within the callback you can execute any code you want. The above is just an example.

So use however you normally use roles.

For example, if your roles package or implementation has hasRole('admin') method, then you would simply use that in the callback:

LogViewer::auth(fn ($request) => $request->user()->hasRole('admin'));

From the callback you just need to return true to allow access, and false to forbid access.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@anonymouse703
Comment options

@arukompas
Comment options

@anonymouse703
Comment options

@arukompas
Comment options

Answer selected by anonymouse703
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants