PHP code example of livelyworks / laravel-yes-authority

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

    

livelyworks / laravel-yes-authority example snippets


    'authority.checkpost'  => \App\Http\Middleware\YesAuthorityCheckpostMiddleware::class
  
    Route::group(['middleware' => 'authority.checkpost'], function () {
        // Place all those routes here which needs authentication and authorization.
    });


    [
        'allow' => ['*'], // Allowed permission to user. Priority is less than deny.
        'deny'  => ['temp1'], // Deny permission to user. Priority is higher than allow.
    ]

    canAccess('temp1');
    // false 

    canAccess('temp1');
    // true or false

    canPublicAccess();
    // true or false

    YesAuthority::check('temp1');
    // true or false

    YesAuthority::isPublicAccess('temp1');
    // true or false

    @canAccess()
       // your logic here.
    @endAccess;

    @canPublicAccess()
       // your logic here.
    @endAccess;
bash
    php artisan vendor:publish  --tag="yesauthority"