PHP code example of itstructure / laravel-rbac

1. Go to this page and download the library: Download itstructure/laravel-rbac 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/ */

    

itstructure / laravel-rbac example snippets


        'memberNameAttributeKey' => function ($row) {
            return $row->first_name . ' ' . $row->last_name;
        }
        

        use Illuminate\Database\Seeder;
        

        class DatabaseSeeder extends Seeder
        {
            public function run()
            {
                $this->call(LaRbacDatabaseSeeder::class);
            }
        }
        

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Itstructure\LaRbac\Interfaces\RbacUserInterface;
use Itstructure\LaRbac\Traits\Administrable;

class User extends Authenticatable implements RbacUserInterface
{
    use Notifiable, Administrable;

    protected $fillable = [
        'name', 'email', 'password', 'roles'
    ];

    protected $hidden = [
        'password', 'remember_token',
    ];
}