diff --git a/app/Console/Commands/InstallAppCommand.php b/app/Console/Commands/InstallAppCommand.php index cadebf3d..db0f0f26 100644 --- a/app/Console/Commands/InstallAppCommand.php +++ b/app/Console/Commands/InstallAppCommand.php @@ -95,7 +95,7 @@ public function handle() $this->error('Missing '.ucfirst($missing_extension).' extension'); } - if (! file_exists('.env')) { + if (!file_exists('.env')) { File::copy('.env.example', '.env'); } @@ -150,7 +150,7 @@ protected function setDatabaseInfo() $this->username = env('DB_USERNAME'); $this->password = env('DB_PASSWORD'); - while (! checkDatabaseConnection()) { + while (!checkDatabaseConnection()) { // Ask for database details $this->host = $this->ask('Enter a host name?', config('config-variables.default_db_host')); $this->port = $this->ask('Enter a database port?', config('config-variables.default_db_port')); @@ -174,7 +174,7 @@ protected function setDatabaseInfo() $contents = preg_replace('/('.preg_quote('DB_USERNAME=').')(.*)/', 'DB_USERNAME='.$this->username, $contents); $contents = preg_replace('/('.preg_quote('DB_PASSWORD=').')(.*)/', 'DB_PASSWORD='.$this->password, $contents); - if (! $contents) { + if (!$contents) { throw new Exception('Error while writing credentials to .env file.'); } @@ -188,7 +188,7 @@ protected function setDatabaseInfo() // Clear DB name in config unset($this->laravel['config']['database.connections.mysql.database']); - if (! checkDatabaseConnection()) { + if (!checkDatabaseConnection()) { $this->error('Can not connect to database!'); } else { $this->info('Connected successfully!'); @@ -243,7 +243,7 @@ protected function getKeyFile() */ protected function createDatabase($database) { - if (! $database) { + if (!$database) { $this->info('Skipping creation of database as env(DB_DATABASE) is empty'); return; @@ -272,7 +272,7 @@ protected function createDatabase($database) */ protected function dumpDB($database) { - if (! empty($database)) { + if (!empty($database)) { // Force the new login to be used DB::purge(); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 15e6bbe9..e1cb0956 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -54,7 +54,7 @@ public function report(Exception $exception) public function render($request, Exception $exception) { if (strpos($request->url(), '/api/') !== false) { - \Log::debug('API Request Exception - '.$request->url().' - '.$exception->getMessage().(! empty($request->all()) ? ' - '.json_encode($request->except(['password'])) : '')); + \Log::debug('API Request Exception - '.$request->url().' - '.$exception->getMessage().(!empty($request->all()) ? ' - '.json_encode($request->except(['password'])) : '')); if ($exception instanceof AuthorizationException) { return $this->setStatusCode(403)->respondWithError($exception->getMessage()); diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php index fb77b7b9..801cfe23 100644 --- a/app/Helpers/helpers.php +++ b/app/Helpers/helpers.php @@ -15,7 +15,7 @@ function generateUuid() return uuid::uuid4(); } -if (! function_exists('homeRoute')) { +if (!function_exists('homeRoute')) { /** * Return the route to the "home" page depending on authentication/authorization status. @@ -37,7 +37,7 @@ function homeRoute() /* * Global helpers file with misc functions. */ -if (! function_exists('app_name')) { +if (!function_exists('app_name')) { /** * Helper to grab the application name. * @@ -49,7 +49,7 @@ function app_name() } } -if (! function_exists('access')) { +if (!function_exists('access')) { /** * Access (lol) the Access:: facade as a simple function. */ @@ -59,7 +59,7 @@ function access() } } -if (! function_exists('history')) { +if (!function_exists('history')) { /** * Access the history facade anywhere. */ @@ -69,7 +69,7 @@ function history() } } -if (! function_exists('gravatar')) { +if (!function_exists('gravatar')) { /** * Access the gravatar helper. */ @@ -79,7 +79,7 @@ function gravatar() } } -if (! function_exists('includeRouteFiles')) { +if (!function_exists('includeRouteFiles')) { /** * Loops through a folder and requires all PHP files @@ -107,7 +107,7 @@ function includeRouteFiles($folder) } } -if (! function_exists('getRtlCss')) { +if (!function_exists('getRtlCss')) { /** * The path being passed is generated by Laravel Mix manifest file @@ -129,7 +129,7 @@ function getRtlCss($path) } } -if (! function_exists('settings')) { +if (!function_exists('settings')) { /** * Access the settings helper. */ @@ -137,13 +137,13 @@ function settings() { // Settings Details $settings = Setting::latest()->first(); - if (! empty($settings)) { + if (!empty($settings)) { return $settings; } } } -if (! function_exists('createNotification')) { +if (!function_exists('createNotification')) { /** * create new notification. * @@ -165,7 +165,7 @@ function createNotification($message, $userId) } } -if (! function_exists('escapeSlashes')) { +if (!function_exists('escapeSlashes')) { /** * Access the escapeSlashes helper. */ @@ -179,7 +179,7 @@ function escapeSlashes($path) } } -if (! function_exists('getMenuItems')) { +if (!function_exists('getMenuItems')) { /** * Converts items (json string) to array and return array. */ @@ -187,11 +187,11 @@ function getMenuItems($type = 'backend', $id = null) { $menu = new \App\Models\Menu\Menu(); $menu = $menu->where('type', $type); - if (! empty($id)) { + if (!empty($id)) { $menu = $menu->where('id', $id); } $menu = $menu->first(); - if (! empty($menu) && ! empty($menu->items)) { + if (!empty($menu) && !empty($menu->items)) { return json_decode($menu->items); } @@ -199,14 +199,14 @@ function getMenuItems($type = 'backend', $id = null) } } -if (! function_exists('getRouteUrl')) { +if (!function_exists('getRouteUrl')) { /** * Converts querystring params to array and use it as route params and returns URL. */ function getRouteUrl($url, $url_type = 'route', $separator = '?') { $routeUrl = ''; - if (! empty($url)) { + if (!empty($url)) { if ($url_type == 'route') { if (strpos($url, $separator) !== false) { $urlArray = explode($separator, $url); @@ -225,7 +225,7 @@ function getRouteUrl($url, $url_type = 'route', $separator = '?') } } -if (! function_exists('renderMenuItems')) { +if (!function_exists('renderMenuItems')) { /** * render sidebar menu items after permission check. */ @@ -235,7 +235,7 @@ function renderMenuItems($items, $viewName = 'backend.includes.partials.sidebar- // if(!empty($item->url) && !Route::has($item->url)) { // return; // } - if (! empty($item->view_permission_id)) { + if (!empty($item->view_permission_id)) { if (access()->allow($item->view_permission_id)) { echo view($viewName, compact('item')); } @@ -246,7 +246,7 @@ function renderMenuItems($items, $viewName = 'backend.includes.partials.sidebar- } } -if (! function_exists('isActiveMenuItem')) { +if (!function_exists('isActiveMenuItem')) { /** * checks if current URL is of current menu/sub-menu. */ @@ -259,7 +259,7 @@ function isActiveMenuItem($item, $separator = '?') if (Active::checkRoutePattern($item->clean_url)) { return true; } - if (! empty($item->children)) { + if (!empty($item->children)) { foreach ($item->children as $child) { $child->clean_url = $child->url; if (strpos($child->url, $separator) !== false) { @@ -275,7 +275,7 @@ function isActiveMenuItem($item, $separator = '?') } } -if (! function_exists('checkDatabaseConnection')) { +if (!function_exists('checkDatabaseConnection')) { /** * @return bool diff --git a/app/Http/Controllers/Api/V1/AuthController.php b/app/Http/Controllers/Api/V1/AuthController.php index dd953a98..ad431484 100644 --- a/app/Http/Controllers/Api/V1/AuthController.php +++ b/app/Http/Controllers/Api/V1/AuthController.php @@ -29,7 +29,7 @@ public function login(Request $request) $credentials = $request->only(['email', 'password']); try { - if (! Auth::attempt($credentials)) { + if (!Auth::attempt($credentials)) { return $this->throwValidation(trans('api.messages.login.failed')); } diff --git a/app/Http/Controllers/Api/V1/ForgotPasswordController.php b/app/Http/Controllers/Api/V1/ForgotPasswordController.php index 8bd3a3b1..ddaefd73 100644 --- a/app/Http/Controllers/Api/V1/ForgotPasswordController.php +++ b/app/Http/Controllers/Api/V1/ForgotPasswordController.php @@ -39,7 +39,7 @@ public function sendResetLinkEmail(Request $request) $user = $this->repository->findByEmail($request->get('email')); - if (! $user) { + if (!$user) { return $this->respondNotFound(trans('api.messages.forgot_password.validation.email_not_found')); } diff --git a/app/Http/Controllers/Api/V1/RegisterController.php b/app/Http/Controllers/Api/V1/RegisterController.php index cc804bd5..77e9dcb3 100644 --- a/app/Http/Controllers/Api/V1/RegisterController.php +++ b/app/Http/Controllers/Api/V1/RegisterController.php @@ -45,7 +45,7 @@ public function register(Request $request) $user = $this->repository->create($request->all()); - if (! Config::get('api.register.release_token')) { + if (!Config::get('api.register.release_token')) { return $this->respondCreated([ 'message' => trans('api.messages.registeration.success'), ]); diff --git a/app/Http/Controllers/Api/V1/UsersController.php b/app/Http/Controllers/Api/V1/UsersController.php index 718d9d0a..2b6c5374 100644 --- a/app/Http/Controllers/Api/V1/UsersController.php +++ b/app/Http/Controllers/Api/V1/UsersController.php @@ -124,7 +124,7 @@ public function deleteAll(Request $request) { $ids = $request->get('ids'); - if (isset($ids) && ! empty($ids)) { + if (isset($ids) && !empty($ids)) { $result = $this->repository->deleteAll($ids); } diff --git a/app/Http/Controllers/Backend/Search/SearchController.php b/app/Http/Controllers/Backend/Search/SearchController.php index 20b71387..358b66bd 100755 --- a/app/Http/Controllers/Backend/Search/SearchController.php +++ b/app/Http/Controllers/Backend/Search/SearchController.php @@ -17,7 +17,7 @@ class SearchController extends Controller */ public function index(Request $request) { - if (! $request->filled('q')) { + if (!$request->filled('q')) { return redirect() ->route('admin.dashboard') ->withFlashDanger(trans('strings.backend.search.empty')); diff --git a/app/Http/Controllers/Frontend/Auth/LoginController.php b/app/Http/Controllers/Frontend/Auth/LoginController.php index 14f49791..e9138986 100755 --- a/app/Http/Controllers/Frontend/Auth/LoginController.php +++ b/app/Http/Controllers/Frontend/Auth/LoginController.php @@ -71,11 +71,11 @@ protected function authenticated(Request $request, $user) /* * Check to see if the users account is confirmed and active */ - if (! $user->isConfirmed()) { + if (!$user->isConfirmed()) { access()->logout(); throw new GeneralException(trans('exceptions.frontend.auth.confirmation.resend', ['user_id' => $user->id]), true); - } elseif (! $user->isActive()) { + } elseif (!$user->isActive()) { access()->logout(); throw new GeneralException(trans('exceptions.frontend.auth.deactivated')); @@ -139,7 +139,7 @@ public function logout(Request $request) public function logoutAs() { //If for some reason route is getting hit without someone already logged in - if (! access()->user()) { + if (!access()->user()) { return redirect()->route('frontend.auth.login'); } diff --git a/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php b/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php index 0d354c9c..91eca980 100755 --- a/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php @@ -50,7 +50,7 @@ public function redirectPath() */ public function showResetForm($token = null) { - if (! $token) { + if (!$token) { return redirect()->route('frontend.auth.password.email'); } diff --git a/app/Http/Controllers/Frontend/Auth/SocialLoginController.php b/app/Http/Controllers/Frontend/Auth/SocialLoginController.php index 47182b8a..bee119a3 100755 --- a/app/Http/Controllers/Frontend/Auth/SocialLoginController.php +++ b/app/Http/Controllers/Frontend/Auth/SocialLoginController.php @@ -51,7 +51,7 @@ public function login(Request $request, $provider) $user = null; // If the provider is not an acceptable third party than kick back - if (! in_array($provider, $this->helper->getAcceptedProviders())) { + if (!in_array($provider, $this->helper->getAcceptedProviders())) { return redirect()->route('frontend.index')->withFlashDanger(trans('auth.socialite.unacceptable', ['provider' => $provider])); } @@ -60,7 +60,7 @@ public function login(Request $request, $provider) * It's redirected to the provider and then back here, where request is populated * So it then continues creating the user */ - if (! $request->all()) { + if (!$request->all()) { return $this->getAuthorizationFirst($provider); } @@ -71,12 +71,12 @@ public function login(Request $request, $provider) return redirect()->route('frontend.index')->withFlashDanger($e->getMessage()); } - if (is_null($user) || ! isset($user)) { + if (is_null($user) || !isset($user)) { return redirect()->route('frontend.index')->withFlashDanger(trans('exceptions.frontend.auth.unknown')); } // Check to see if they are active. - if (! $user->isActive()) { + if (!$user->isActive()) { throw new GeneralException(trans('exceptions.frontend.auth.deactivated')); } diff --git a/app/Http/Middleware/RouteNeedsPermission.php b/app/Http/Middleware/RouteNeedsPermission.php index 648d9dd3..16f6a0db 100755 --- a/app/Http/Middleware/RouteNeedsPermission.php +++ b/app/Http/Middleware/RouteNeedsPermission.php @@ -32,7 +32,7 @@ public function handle($request, Closure $next, $permission, $needsAll = false) $access = access()->allow($permission); } - if (! $access) { + if (!$access) { return redirect() ->route('frontend.index') ->withFlashDanger(trans('auth.general_error')); diff --git a/app/Http/Middleware/RouteNeedsRole.php b/app/Http/Middleware/RouteNeedsRole.php index ec231b59..e7b83f16 100755 --- a/app/Http/Middleware/RouteNeedsRole.php +++ b/app/Http/Middleware/RouteNeedsRole.php @@ -32,7 +32,7 @@ public function handle($request, Closure $next, $role, $needsAll = false) $access = access()->hasRole($role); } - if (! $access) { + if (!$access) { return redirect() ->route('frontend.index') ->withFlashDanger(trans('auth.general_error')); diff --git a/app/Http/Middleware/SessionTimeout.php b/app/Http/Middleware/SessionTimeout.php index 9d92fc9d..8be173d2 100755 --- a/app/Http/Middleware/SessionTimeout.php +++ b/app/Http/Middleware/SessionTimeout.php @@ -43,10 +43,10 @@ public function handle($request, Closure $next) //Cookie Name for when 'remember me' is checked $remember_cookie = \Auth::guard()->getRecallerName(); - if (! Cookie::has($remember_cookie) && config('session.timeout_status')) { + if (!Cookie::has($remember_cookie) && config('session.timeout_status')) { $isLoggedIn = $request->path() != '/logout'; - if (! session('lastActivityTime')) { + if (!session('lastActivityTime')) { $this->session->put('lastActivityTime', time()); } elseif (time() - $this->session->get('lastActivityTime') > $this->timeout) { $this->session->forget('lastActivityTime'); diff --git a/app/Http/Responses/ViewResponse.php b/app/Http/Responses/ViewResponse.php index 53f52fb1..1e31d525 100644 --- a/app/Http/Responses/ViewResponse.php +++ b/app/Http/Responses/ViewResponse.php @@ -35,7 +35,7 @@ public function __construct($view, $with = []) */ public function toResponse($request) { - if (! empty($this->with)) { + if (!empty($this->with)) { return view($this->view)->with($this->with); } diff --git a/app/Http/Utilities/FileUploads.php b/app/Http/Utilities/FileUploads.php index 957eef16..8e422fa6 100755 --- a/app/Http/Utilities/FileUploads.php +++ b/app/Http/Utilities/FileUploads.php @@ -368,7 +368,7 @@ public function moveFile($source, $destination) $destination = $filePath.DIRECTORY_SEPARATOR.$destination; if (File::exists($source)) { $dir = dirname($destination); - if (! is_dir($dir)) { + if (!is_dir($dir)) { mkdir($dir, 0777, true); } @@ -393,7 +393,7 @@ public function copyFile($source, $destination) $destination = $filePath.DIRECTORY_SEPARATOR.$destination; if (File::exists($source)) { $dir = dirname($destination); - if (! is_dir($dir)) { + if (!is_dir($dir)) { mkdir($dir, 0777, true); } diff --git a/app/Http/Utilities/Notification.php b/app/Http/Utilities/Notification.php index 9e33f87c..78cd245e 100755 --- a/app/Http/Utilities/Notification.php +++ b/app/Http/Utilities/Notification.php @@ -130,7 +130,7 @@ public function setOptions(array $options) public function raiseerror($errorCode) { $codeValue = $this->getErrorMessages(); - if (! isset($codeValue[$errorCode])) { + if (!isset($codeValue[$errorCode])) { $errorException = 'Erro code '.$errorCode; } else { $errorException = $codeValue[$errorCode]; diff --git a/app/Http/Utilities/NotificationIos.php b/app/Http/Utilities/NotificationIos.php index 0e96dad2..edef630b 100755 --- a/app/Http/Utilities/NotificationIos.php +++ b/app/Http/Utilities/NotificationIos.php @@ -54,7 +54,7 @@ protected function _send($deviceId, $message, $sendOptions = []) stream_context_set_option($ctx, 'ssl', 'passphrase', $this->_passPhrase); $fp = stream_socket_client(self::$_url, $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx); - if (! $fp) { + if (!$fp) { $this->raiseerror(self::ERROR_CONNECTION_FAILED); } //return 'Connected to APNS' . PHP_EOL; @@ -72,7 +72,7 @@ protected function _send($deviceId, $message, $sendOptions = []) $result = fwrite($fp, $msg, strlen($msg)); } //echo "
-------
"; - if (! $result) { + if (!$result) { return 'Message not delivered'.PHP_EOL; } else { return 'Message successfully delivered'.PHP_EOL; @@ -107,7 +107,7 @@ public function setPemFile($pemFile = 'apns_baseproject_dev.pem') // echo $_SERVER['DOCUMENT_ROOT'].'/app/Http/Controllers/Utilities/'.$pemFile;exit; //echo dirname(__FILE__); exit; // echo file_get_contents(dirname(__FILE__).'/'.$pemFile); exit; - if (! (file_exists($newPemFilePath)) && ! (is_readable($newPemFilePath))) { + if (!(file_exists($newPemFilePath)) && !(is_readable($newPemFilePath))) { $error = $this->raiseerror(self::ERROR_PEM_NOTACCESSIBLE); } $this->_pemFile = $newPemFilePath; diff --git a/app/Http/Utilities/PushNotification.php b/app/Http/Utilities/PushNotification.php index c10e4f45..b0bbbe4b 100755 --- a/app/Http/Utilities/PushNotification.php +++ b/app/Http/Utilities/PushNotification.php @@ -61,7 +61,7 @@ public function _pushNotification($msg, $type, $devicetoken) */ public function _pushToAndroid($registrationIds, $msg) { - if (! is_array($registrationIds)) { + if (!is_array($registrationIds)) { $registrationIds = [$registrationIds]; } $fields = [ @@ -108,7 +108,7 @@ public function _pushtoios($devicetoken, $message) //$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx); - if (! $fp) { + if (!$fp) { exit("Failed to connect amarnew: $err $errstr".PHP_EOL); } @@ -122,7 +122,7 @@ public function _pushtoios($devicetoken, $message) $result = fwrite($fp, $msg, strlen($msg)); - if (! $result) { + if (!$result) { return false; } else { return true; diff --git a/app/Models/Access/Role/Traits/RoleAccess.php b/app/Models/Access/Role/Traits/RoleAccess.php index bae9cc53..cbac1bd5 100755 --- a/app/Models/Access/Role/Traits/RoleAccess.php +++ b/app/Models/Access/Role/Traits/RoleAccess.php @@ -16,7 +16,7 @@ trait RoleAccess */ public function savePermissions($inputPermissions) { - if (! empty($inputPermissions)) { + if (!empty($inputPermissions)) { $this->permissions()->sync($inputPermissions); } else { $this->permissions()->detach(); diff --git a/app/Models/Access/User/Traits/Attribute/UserAttribute.php b/app/Models/Access/User/Traits/Attribute/UserAttribute.php index f511e16a..22a49b15 100755 --- a/app/Models/Access/User/Traits/Attribute/UserAttribute.php +++ b/app/Models/Access/User/Traits/Attribute/UserAttribute.php @@ -20,7 +20,7 @@ public function canChangeEmail() */ public function canChangePassword() { - return ! app('session')->has(config('access.socialite_session_name')); + return !app('session')->has(config('access.socialite_session_name')); } /** @@ -62,7 +62,7 @@ public function getPictureAttribute() */ public function getPicture($size = false) { - if (! $size) { + if (!$size) { $size = config('gravatar.default.size'); } @@ -176,7 +176,7 @@ public function getStatusButtonAttribute($class) */ public function getConfirmedButtonAttribute($class) { - if (! $this->isConfirmed() && access()->allow('edit-user')) { + if (!$this->isConfirmed() && access()->allow('edit-user')) { return ' '; } @@ -228,7 +228,7 @@ public function getLoginAsButtonAttribute($class) /* * If the admin is currently NOT spoofing a user */ - if (access()->allow('login-as-user') && (! session()->has('admin_user_id') || ! session()->has('temp_user_id'))) { + if (access()->allow('login-as-user') && (!session()->has('admin_user_id') || !session()->has('temp_user_id'))) { //Won't break, but don't let them "Login As" themselves if ($this->id != access()->id()) { return '