public function boot(GateContract $gate) { parent::boot($gate); $gate->before(function ($user, $ability) { if ($user->isSuperAdmin()) { return true; } }); $gate->define('dashboard', function ($user) { return $user->isAdmin(); }); $gate->define('node-admin', function ($user, $type, $module, $node, $action, $id = NULL) { $custom_check = \CustomFunc::check_permission($type, $module, $node, $action, $id); if ($custom_check != 'none') { if ($custom_check == 'true') { $return = true; } else { $return = false; } } else { $return = false; if ($node->permission) { if ($user->hasPermission($node->permission)) { $return = true; } } else { $return = true; } } return $return; }); }