1. Go to this page and download the library: Download techlify-inc/laravel-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/ */
techlify-inc / laravel-rbac example snippets
class User extends Authenticatable
{
use TechlifyInc\LaravelRbac\Traits\LaravelRbac;
}
use \TechlifyInc\LaravelRbac\Models\Role;
$adminRole = Role::find(1);
$adminRole->attachPermission($createPermission);
//or you can insert only slug
$adminRole->attachPermission("product.create");
use App\User;
$user = User::find(1);
if ($user->hasPermission('product.create')) {
}
// OR for currently logged in user
if (auth()->user()->hasPermission('product.create'))
// Get the set of users
GET api/users
// Get a single user
GET api/users/{id}
// Add a new user
POST api/users
// Update a user record
PATCH api/users/{id}
// Delete a user record
DELETE api/users/{id}
// Change the current user password
POST api/user/current/update-password {current_password, new_password}
// Log out the currently logged in user
POST api/user/logout
// Get the User record of the currently logged in user
GET api/user/current
$ php artisan migrate
$ php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.