PHP code example of asseco-voice / laravel-json-authorization

1. Go to this page and download the library: Download asseco-voice/laravel-json-authorization 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/ */

    

asseco-voice / laravel-json-authorization example snippets


public function getAuthorizableSets(): array
{
    return [
        'roles'  => Auth::user()->roles,
        'groups' => Auth::user()->groups,
        'id'     => Auth::user()->id,
    ];
}

public function getAuthorizableSets(): array
{
    return [
        'roles'  => Auth::user()->roles
    ];
}

public function getAuthorizableSets(): array
{
    return [
        'roles'  => $someClass->methodCall(Auth::user()->id, 'https://my-external-service')
    ];
}