1. Go to this page and download the library: Download psecio/propauth-provider 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/ */
psecio / propauth-provider example snippets
'providers' => [
/* other providers */
\Psecio\PropAuth\PolicyTemplateServiceProvider::class,
]
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Psecio\PropAuth\Enforcer;
use Psecio\PropAuth\Policy;
use Psecio\PropAuth\PolicySet;
class PolicyServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton('policies', function($app) {
$set = PolicySet::instance()
->add('can-edit', Policy::instance()->hasUsername('ccornutt'))
);
return Enforcer::instance($set);
});
}
}