PHP code example of opscale-co / nova-authorization

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

    

opscale-co / nova-authorization example snippets



// in app/Providers/NovaServiceProvider.php
// ...
public function tools()
{
    return [
        // ...
        new \Opscale\NovaAuthorization\Tool(),
    ];
}



// in app/Nova/User.php
// ...
public function fields(NovaRequest $request): array
{
    return [
        // ...
        Tag::make(_('Roles'), 'roles', \Opscale\NovaAuthorization\Nova\Role::class)
            ->hideFromIndex(),
    ];
}