PHP code example of jameron / regulator

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

    

jameron / regulator example snippets


        Jameron\Regulator\RegulatorServiceProvider::class,

        'Regulator' => Jameron\Regulator\Facades\RegulatorFacade::class,

use Illuminate\Support\Facades\Schema;

function boot()
{
    Schema::defaultStringLength(191);
}

$this->call(\Jameron\Regulator\database\seeds\RegulatorSeeder::class);
 artisan db:seed --class=\\Jameron\\Regulator\\database\\seeds\\RegulatorSeeder


use Jameron\Regulator\Models\Traits\HasRoles;
class User extends Authenticatable
{
	use HasRoles;

    public function getRoleAttribute()
    {
        $roles = [];
        foreach($this->roles()->get() as $role) {
            $roles[] = $role->slug;
        }
        return implode(',', $roles);
    } 

    public function getEnabledAttribute()
    {
        return ($this->disabled) ? 'no' : 'yes';
    }


protected $subscribe = [
\Jameron\Regulator\Listeners\UserEventSubscriber::class,
];

php artisan vendor:publish

php artisan make:auth

php artisan migrate