almas/laravel-permission

A dynamic role and permission system designed to reduce development time.

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Language:Blade

pkg:composer/almas/laravel-permission

1.0.0 2025-10-23 22:46 UTC

This package is auto-updated.

Last update: 2025-10-23 23:15:52 UTC


README

Latest Version on Packagist Total Downloads

Installation

You can install the package via Composer:

composer require almas/laravel-permission

Set Super Admin Set the Super Admin email in your .env file:

SUPER_ADMIN_EMAIL=superadmin@gmail.com
  • If not defined, the default is superadmin@gmail.com.
  • A random password is automatically generated for the Super Admin.
  • You can reset the password via the "Forgot Password" option

After installation, run the following Artisan command to set up everything:

php artisan permission

This command will:

  • Run necessary database migrations
  • Seed default roles and permissions automatically

No additional setup is required — you're ready to go!

Publish Configuration File

To publish the configuration file for this package, run the following command:

php artisan vendor:publish --tag=permission-config

Super Admin Features

  • Only the Super Admin can create and delete permissions.
  • For every new permission added to the system, the Super Admin is automatically granted that permission.

Route Registration

Add the following line to your routes/web.php file:

use Illuminate\Support\Facades\Route;

Route::permission();
  • By default, all routes will be protected using the auth middleware.
  • This will automatically register all necessary permission management routes.

Route Prefix Behavior

  • When using Route::permission();, the base route will be:
{your-app-url}/permissions
  • You can customize the base route prefix by passing a parameter to the Route::permission() method:
Route::permission('custom-prefix');
  • This will change the base route to:
{your-app-url}/custom-prefix

Blade Helper to Get Base Permission URL

@PermissionLink

Usage

  • Get All Permissions (as array):
user_permission()
  • Check a Single Permission: (eg. true/false):
user_permission('show-users')
  • Blade Directives:
@user_permission('show-users')
    <a>Show Users</a>
@end_user_permission

License

The MIT License (MIT). Please see License File for more information.