PHP code example of mamikon / role-manager

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

    

mamikon / role-manager example snippets



Mamikon\RoleManager\RoleManagerProvider::class,



'RoleManager' => Mamikon\RoleManager\RoleManagerFacade::class,

'edit_post' => [
    'description' => "Edit Post",
    'class' => App\Permissions\Post::class, // not 

'super-admin' =>  "Can Do everything",

'assignPermissionsToRole'=> [
    'editor' => [
            'edit_post',
            'publish_post',
            //...
        ]
 ],

'assignPermissionsToRole'=> [
    'super-admin' => '*'
 ],

'assignRoleToUser' => [
    'super-admin'=>'[email protected]',
    'editor'=>'[email protected]',
 ],

    'permissionsTable'=>'other_permissions',
    'rolesTable'=>'other_roles',

'routePrefix'=>'role-manager',

'extendedView'=>'layouts.app',


 'extendedSection'=>'content',


$ php aritsan migrate

$ php aritsan permissions:migrate

if (Gate::allows('update-post', $post)) {
    // The current user can update the post...
}

if (Gate::denies('update-post', $post)) {
    // The current user can't update the post...
}
bash

 $ php artisan vendor:publish --provider="Mamikon\RoleManager\RoleManagerProvider"

bash
$ php artisan permissions:migrate