Permissions

Read carefully to understand how to use permissions and what is convention of creating a new permissions:

{danger} Remember

The permission name must be followed follwing convention. Assume your route is look like that:

Route::get('users', [TestController::class,'index']);

Now your permission input will be look like that:

  • name : TestController@index
  • display_name : User List
  • description : user , cause this method is related to users

Now use authorized middleware to protect user access like that:

Route::middleware(['authorized'])
    ->group(function () {
        Route::controller(DatabaseController::class)
            ->prefix('database')
            ->group(function () {
                Route::get('backup', 'backupDatabase')
            });
    });

Now assume, your permission is not related to route. This case, just create a permission and use this condition to check:

@if (isAbleToSeeMenu('your_permission_name'))

@endif

Permission List

image