$value) { if (is_null($value) || is_bool($value)) { $preparedPermissions[$name] = $value; continue; } if (!is_null(static::value($value))) { $preparedPermissions[$name] = static::value($value); } } return json_encode($preparedPermissions); } /** * Get the permission value. * * @param $permission * * @return bool|null */ protected static function value($permission) { if ($permission === '1') { return true; } if ($permission === '-1') { return false; } } /** * Get enabled module permissions. * * @return array */ private static function getEnabledModulePermissions() { $permissions = []; foreach (Module::allEnabled() as $module) { $config = config('fleetcart.modules.' . strtolower($module->getName()) . '.permissions'); if (!is_null($config)) { $permissions[$module->getName()] = $config; } } return $permissions; } /** * Get active theme permissions. * * @return array */ private static function getActiveThemePermissions() { $permissions = config('fleetcart.themes.' . strtolower(setting('active_theme')) . '.permissions'); if (is_null($permissions)) { return []; } return [setting('active_theme') => $permissions]; } }