for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use z1haze\Acl\Exceptions\LevelNotFoundException;
use z1haze\Acl\Exceptions\UserNotFoundException;
use z1haze\Acl\Models\Level;
if (!function_exists('aclGetALevel')) {
/**
* Helper function to get the level whether it is the ID
* or the name of the level, or the level object itself.
*
* @param mixed $level
* @return Level
* @throws LevelNotFoundException
*/
function aclGetALevel($level)
{
if (is_string($level)) {
$level = config('laravel-acl.level', Level::class)::whereName($level)->first();
}
if (is_int($level)) {
$level = config('laravel-acl.level', Level::class)::find($level);
if (!$level) {
throw new LevelNotFoundException();
return $level;
if (!function_exists('aclGetUser')) {
* PERMISSION
* Helper function to get the user whether it is the user ID
* or the user object itself.
* @param $user
* @return User
* @throws UserNotFoundException
function aclGetUser($user)
if (is_int($user)) {
$user = config('laravel-acl.user')::find($user);
if (!$user) {
throw new UserNotFoundException;
return $user;