PHP code example of webx-ui / module-auth

1. Go to this page and download the library: Download webx-ui/module-auth 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/ */

    

webx-ui / module-auth example snippets


$role = Role::create([
    'slug' => 'editor',
    'name' => 'Editor',
    'permissions' => ['pages.view', 'pages.manage'],
]);

$user->roles()->attach($role);

$user->hasPermission('pages.manage'); // true
$user->permissions();                 // flattened, deduplicated, sorted

Route::middleware(['cms.auth', 'cms.can:pages.manage'])->group(/* … */);
bash
composer migrate
php artisan webx:admin