shadowbane / authorization-module
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:laravel-module
Requires
- backpack/crud: 4.1.*
- joshbrw/laravel-module-installer: ^1.0.0
- nwidart/laravel-modules: ^8.2.0
- spatie/laravel-permission: >=3.16.0
This package is auto-updated.
Last update: 2024-11-07 11:19:07 UTC
README
Modular Authorization package for Laravel Backpack
Yet another Admin interface for spatie/laravel-permission. It allows admins to easily add/edit/remove users, roles and permissions, using Laravel Backpack. This module is based on Backpack\PermissionManager and spatie/laravel-permission. So if you like the package, please support the original authors.
Installation
-
Make sure you've already installed Backpack.
-
Install nWidart/laravel-modules and joshbrw/laravel-module-installer
-
In your terminal:
composer require backpack/permissionmanager
-
Finish all installation steps for spatie/laravel-permission, which as been pulled as a dependency. Run its migrations. Publish its config files. Most likely it's:
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations" php artisan migrate php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config" // then First, add the Spatie\Permission\Traits\HasRoles trait to your User model(s)
-
Publish the config file & run the migrations
php artisan vendor:publish --provider="Modules\Authorization\Providers\AuthorizationServiceProvider" --tag="config"
-
Add
CrudTrait
andHasRole
to user model<?php namespace App\Models; use Backpack\CRUD\app\Models\Traits\CrudTrait; // <------------------------------- this one use Spatie\Permission\Traits\HasRoles;// <---------------------- and this one use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { use CrudTrait; // <----- this use HasRoles; // <------ and this /** * Your User Model content */
-
[Optional] Add a menu item for it in
resources/views/vendor/backpack/base/inc/sidebar_content.blade.php
ormenu.blade.php
:<!-- Users, Roles, Permissions --> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"> <i class="nav-icon la la-users"></i> Authentication </a> <ul class="nav-dropdown-items"> <li class="nav-item"> <a class="nav-link" href="{{ backpack_url('role') }}"> <i class="nav-icon la la-id-badge"></i><span>Roles</span> </a> </li> <li class="nav-item"> <a class="nav-link" href="{{ backpack_url('permission') }}"> <i class="nav-icon la la-key"></i><span>Permissions</span> </a> </li> <li class="nav-item"> <a class="nav-link" href="{{ backpack_url('user') }}"> <i class="nav-icon la la-user"></i> <span>Users</span> </a> </li> </ul> </li>
Change log
Documentation
Coming soon
License
Credits
All original developers of