PHP code example of shadowbane / authorization-module

1. Go to this page and download the library: Download shadowbane/authorization-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shadowbane / authorization-module example snippets


     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
         */
    
bash
    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)
    
bash
    php artisan vendor:publish --provider="Modules\Authorization\Providers\AuthorizationServiceProvider" --tag="config"
    
resources/views/vendor/backpack/base/inc/sidebar_content.blade.php
menu.blade.php