PHP code example of bramalho / laravel-user-permissions
1. Go to this page and download the library: Download bramalho/laravel-user-permissions 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/ */
bramalho / laravel-user-permissions example snippets
namespace App;
use BRamalho\LaravelUserPermissions\Traits\Permission;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable, Permission;
//...
}
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use BRamalho\LaravelUserPermissions\Http\Middleware\UserHasRole;
use BRamalho\LaravelUserPermissions\Http\Middleware\UserHasPermission;
class Kernel extends HttpKernel
{
// ...
protected $routeMiddleware = [
// ...
'role' => UserHasRole::class,
'permission' => UserHasPermission::class
];
}