1. Go to this page and download the library: Download cosmos/rbac 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/ */
php
Route::group(['middleware' => ['role:admin']], function () {
//
});
// You can separate multiple roles or permission with a '|' (pipe) character.
Route::group(['middleware' => ['permission:edit articles|publish articles']], function () {
//
});
Route::get('admin/profile', function () {
//
})->middleware('role:admin', 'permission:admin.access');
php
public function __construct()
{
$this->middleware('role:super-user');
// or
$this->middleware(['role:admin', 'permission:admin.access']);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.