PHP code example of mahdiawan-nk / laravel-permission-group

1. Go to this page and download the library: Download mahdiawan-nk/laravel-permission-group 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/ */

    

mahdiawan-nk / laravel-permission-group example snippets


// config/app.php

'providers' => [
    MahdiawanNk\LaravelPermissionGroup\Providers\PermissionServiceProvider::class,
],

use MahdiawanNk\PermissionGroup\Facades\PermissionGroup;

PermissionGroup::create('Manajemen User', [
    'user.create',
    'user.edit',
    'user.delete',
]);

$groups = PermissionGroup::allGrouped();

foreach ($groups as $group => $permissions) {
    echo "Group: $group\n";
    foreach ($permissions as $permission) {
        echo "- " . $permission->name . "\n";
    }
}