PHP code example of sehrgut / laravel-object-roles
1. Go to this page and download the library: Download sehrgut/laravel-object-roles 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/ */
sehrgut / laravel-object-roles example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use SehrGut\LaravelObjectRoles\HasRolesAndPermissions;
use SehrGut\LaravelObjectRoles\Models\Permission;
class User extends Model
{
use HasRolesAndPermissions;
}
$permission = SehrGut\LaravelObjectRoles\Models\Permission::create([
'name' => 'posts.update',
'description' => 'The ability to update existing Post objects',
]);
$role = SehrGut\LaravelObjectRoles\Models\Role::create([
'name' => 'EDITOR',
'description' => 'A User who can manage content',
]);