PHP code example of amethyst / permission
1. Go to this page and download the library: Download amethyst/permission 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/ */
amethyst / permission example snippets
use Amethyst\Models\Permission;
use Symfony\Component\Yaml\Yaml;
Permission::create([
'effect' => 'accept',
'type' => 'data',
'payload' => Yaml::dump([
'action' => 'create',
'data' => 'foo'
]),
'agent' => '{{ agent.id }} == 1',
]);
use Amethyst\Models\Permission;
use Symfony\Component\Yaml\Yaml;
Permission::create([
'type' => 'route',
'payload' => Yaml::dump([
'url' => '/profile'
])
]);
use Amethyst\Models\Permission;
use Symfony\Component\Yaml\Yaml;
Permission::create([
'type' => 'route',
'payload' => Yaml::dump([
'url' => [
'/profile',
'/recovery-password'
],
'method' => [
'POST',
'GET'
]
])
]);
use Amethyst\Models\Permission;
use Symfony\Component\Yaml\Yaml;
Permission::create([
'type' => 'route',
'payload' => Yaml::dump([
'url' => 'foo.*'
]),
'agent' => '{{ agent.id }} === 2'
]);
use Amethyst\Models\Permission;
use Symfony\Component\Yaml\Yaml;
Permission::create([
'type' => 'data',
'payload' => Yaml::dump([
'name' => [
'post'
],
'action' => [
'query',
],
'filter' => [
'name ct "foo"'
]
]),
'agent' => '{{ agent.id }} === 2'
]);