Prevent access using spatie permissions #16
Replies: 5 comments 5 replies
-
Great post @snapey ! 👏 Added some links to the Spatie's package for easier navigation 😄 |
Beta Was this translation helpful? Give feedback.
-
I absolutely love the package middlewares provided by spatie/laravel-permission If you have the package middlewares setup already, then you can easily use them in the log viewer route middleware. Here is permalink to the doc: https://spatie.be/docs/laravel-permission/v5/basic-usage/middleware#content-package-middleware So using something like |
Beta Was this translation helpful? Give feedback.
-
easy and simple . thanks
|
Beta Was this translation helpful? Give feedback.
-
how to set the token in the blade file?
|
Beta Was this translation helpful? Give feedback.
-
Hi, Just add this to
|
Beta Was this translation helpful? Give feedback.
-
I offer a solution for protecting the logs using Spatie's Laravel Permissions package;
Create a permission
For instance 'view-logs'. User will need this permission, or a role that provides this permission to access the logs.
Learn how to set up permissions
Create a middleware
app\Http\MiddlewareViewLogs.php
Create a name for this middleware
In app\Http\Kernel.php
Add the following to $routeMiddleware array
Add middleware to the the log viewer config
Beta Was this translation helpful? Give feedback.
All reactions