If you want to add a permission on the basis of Laravel routes then YesAuthority authorization library is very useful to do so. Spatie, Bouncer and other many more libraries are available for Laravel authorization, but these libraries uses Laravel Eloquent models to set up permissions and ability. In YesAuthority you can allow / deny permission from single file, you can statically define your rules in yes-authority.php
or you can define your rules in Database for dynamic permissions. You can simply add following syntax to check the route is accessible or not.
Syntax :
canAccess(‘test.route.name’);
// true
For more information visit at –