1. Go to this page and download the library: Download aammui/role-permission 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/ */
aammui / role-permission example snippets
// App\Exceptions\Handler.php;
use Aammui\RolePermission\Exception\UserNotLoginException;
use Aammui\RolePermission\Exception\RoleDoesNotExistException;
....
public function render($request, Throwable $exception)
{
if ($exception instanceof UserNotLoginException) {
return redirect('/login')
->with('error', $exception->getMessage());
}
if ($exception instanceof RoleDoesNotExistException) {
return redirect('/login')
->with('error', $exception->getMessage());
}
return parent::render($request, $exception);
}