@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function detachPermissions(mixed $role): bool |
| 28 | 28 | { |
| 29 | - $role = ! filter_var($role, FILTER_VALIDATE_INT) ? $role : $this->find($role); |
|
| 29 | + $role = !filter_var($role, FILTER_VALIDATE_INT) ? $role : $this->find($role); |
|
| 30 | 30 | $role->permissions()->detach(); |
| 31 | 31 | |
| 32 | 32 | return true; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function attachPermissions(mixed $role, array $permissionIds): bool |
| 43 | 43 | { |
| 44 | - $role = ! filter_var($role, FILTER_VALIDATE_INT) ? $role : $this->find($role); |
|
| 44 | + $role = !filter_var($role, FILTER_VALIDATE_INT) ? $role : $this->find($role); |
|
| 45 | 45 | $role->permissions()->attach($permissionIds); |
| 46 | 46 | |
| 47 | 47 | return true; |
@@ -47,9 +47,9 @@ |
||
| 47 | 47 | /** |
| 48 | 48 | * Check report existance and permission. |
| 49 | 49 | */ |
| 50 | - if (! $report) { |
|
| 50 | + if (!$report) { |
|
| 51 | 51 | Errors::notFound('report'); |
| 52 | - } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
| 52 | + } elseif (!$skipPermission && !$this->userService->can($report->view_name, 'report')) { |
|
| 53 | 53 | Errors::noPermissions(); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function renderReport(mixed $report, array $conditions = [], int $perPage = 0): mixed |
| 32 | 32 | { |
| 33 | - $report = ! filter_var($report, FILTER_VALIDATE_INT) ? $report : $this->find($report); |
|
| 33 | + $report = !filter_var($report, FILTER_VALIDATE_INT) ? $report : $this->find($report); |
|
| 34 | 34 | /** |
| 35 | 35 | * Fetch data from the report based on the given conditions. |
| 36 | 36 | */ |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $permission = $routeActions[1]; |
| 58 | 58 | |
| 59 | 59 | $this->auth->shouldUse('api'); |
| 60 | - if (! in_array($permission, $skipLoginCheck)) { |
|
| 60 | + if (!in_array($permission, $skipLoginCheck)) { |
|
| 61 | 61 | $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $permission) { |
| 62 | 62 | $user = $this->auth->user(); |
| 63 | 63 | $isPasswordClient = $user->token() ? $user->token()->client->password_client : false; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
| 70 | - } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
| 70 | + } elseif (!$isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
| 71 | 71 | } else { |
| 72 | 72 | Errors::noPermissions(); |
| 73 | 73 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | return $values; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) { |
|
| 43 | + if (!$primaryLocale || !is_object($values) || !property_exists($values, $primaryLocale)) { |
|
| 44 | 44 | return $values ? (isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values) : ''; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | ]; |
| 125 | 125 | |
| 126 | 126 | |
| 127 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
| 127 | + if (!$skipLoginCheck || !in_array($method, $skipLoginCheck)) { |
|
| 128 | 128 | $route['headers']['Authorization'] = 'Bearer {token}'; |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | if ($className) { |
| 184 | 184 | $reflectionClass = new \ReflectionClass($className); |
| 185 | 185 | } elseif (in_array($reflectionMethod->getName(), ['store', 'update'])) { |
| 186 | - $className = 'App\\Modules\\' . ucfirst($module) . '\\Http\\Requests\\Store' . ucfirst($modelName); |
|
| 186 | + $className = 'App\\Modules\\'.ucfirst($module).'\\Http\\Requests\\Store'.ucfirst($modelName); |
|
| 187 | 187 | $reflectionClass = new \ReflectionClass($className); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $errors = []; |
| 212 | 212 | foreach (\Module::all() as $module) { |
| 213 | - $nameSpace = 'App\\Modules\\' . $module['basename']; |
|
| 214 | - $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
| 213 | + $nameSpace = 'App\\Modules\\'.$module['basename']; |
|
| 214 | + $class = $nameSpace.'\\Errors\\'.$module['basename'].'Errors'; |
|
| 215 | 215 | $reflectionClass = new \ReflectionClass($class); |
| 216 | 216 | foreach ($reflectionClass->getMethods() as $method) { |
| 217 | 217 | $methodName = $method->name; |
@@ -257,16 +257,16 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | protected function getModels($modelName, &$docData, $reflectionClass) |
| 259 | 259 | { |
| 260 | - if ($modelName && ! Arr::has($docData['models'], $modelName)) { |
|
| 260 | + if ($modelName && !Arr::has($docData['models'], $modelName)) { |
|
| 261 | 261 | $repo = call_user_func_array("\Core::{$modelName}", []); |
| 262 | - if (! $repo) { |
|
| 262 | + if (!$repo) { |
|
| 263 | 263 | return; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $modelClass = get_class($repo->model); |
| 267 | 267 | $nameSpaceArr = explode('\\', $modelClass); |
| 268 | 268 | array_pop($nameSpaceArr); |
| 269 | - $factory = implode('\\', $nameSpaceArr) . '\\Database\Factories\\' . ucfirst($modelName) . 'Factory'; |
|
| 269 | + $factory = implode('\\', $nameSpaceArr).'\\Database\Factories\\'.ucfirst($modelName).'Factory'; |
|
| 270 | 270 | $model = App::make($factory)->make(); |
| 271 | 271 | |
| 272 | 272 | $property = $reflectionClass->getProperty('modelResource'); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $body = $this->getMethodBody($reflectionMethod); |
| 281 | 281 | foreach ($relationMethods as $relationMethod) { |
| 282 | 282 | $relation = $reflectionMethod->getName(); |
| 283 | - if (strpos($body, '$this->' . $relationMethod) && $relation !== 'morphedByMany') { |
|
| 283 | + if (strpos($body, '$this->'.$relationMethod) && $relation !== 'morphedByMany') { |
|
| 284 | 284 | $relations[] = $relation; |
| 285 | 285 | break; |
| 286 | 286 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $this->container['slug'] = Str::slug($this->argument('slug')); |
| 92 | 92 | $this->container['name'] = Str::studly($this->container['slug']); |
| 93 | 93 | $this->container['version'] = '1.0'; |
| 94 | - $this->container['description'] = 'This is the description for the ' . $this->container['name'] . ' module.'; |
|
| 94 | + $this->container['description'] = 'This is the description for the '.$this->container['name'].' module.'; |
|
| 95 | 95 | $this->container['location'] = config('modules.default_location'); |
| 96 | 96 | $this->container['provider'] = config("modules.locations.{$this->container['location']}.provider"); |
| 97 | 97 | $this->container['basename'] = Str::studly($this->container['slug']); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $progress->finish(); |
| 126 | 126 | |
| 127 | - event($this->container['slug'] . '.module.made'); |
|
| 127 | + event($this->container['slug'].'.module.made'); |
|
| 128 | 128 | |
| 129 | 129 | $this->info("\nModule generated successfully."); |
| 130 | 130 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $directory = module_path(null, $this->container['basename'], $location); |
| 147 | - $source = __DIR__ . '/Stubs/Module'; |
|
| 147 | + $source = __DIR__.'/Stubs/Module'; |
|
| 148 | 148 | |
| 149 | 149 | $this->files->makeDirectory($directory); |
| 150 | 150 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $subPath = str_replace($search, $replace, $subPath); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $filePath = $directory . '/' . $subPath; |
|
| 166 | + $filePath = $directory.'/'.$subPath; |
|
| 167 | 167 | |
| 168 | 168 | // if the file is module.json, replace it with the custom manifest file name |
| 169 | 169 | if ($file->getFilename() === 'module.json' && $manifest) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $dir = dirname($filePath); |
| 180 | 180 | |
| 181 | - if (! $this->files->isDirectory($dir)) { |
|
| 181 | + if (!$this->files->isDirectory($dir)) { |
|
| 182 | 182 | $this->files->makeDirectory($dir, 0755, true); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -213,22 +213,22 @@ discard block |
||
| 213 | 213 | ]; |
| 214 | 214 | |
| 215 | 215 | $replace = [ |
| 216 | - ucfirst($modelNameSingular) . 'Factory', |
|
| 216 | + ucfirst($modelNameSingular).'Factory', |
|
| 217 | 217 | $modelNameSingular, |
| 218 | 218 | $this->container['slug'], |
| 219 | 219 | ucfirst($modelName), |
| 220 | 220 | ucfirst($modelNameSingular), |
| 221 | - ucfirst($modelName) . 'DatabaseSeeder', |
|
| 222 | - ucfirst($modelName) . 'TableSeeder', |
|
| 223 | - ucfirst($modelNameSingular) . 'Controller', |
|
| 224 | - ucfirst($modelNameSingular) . 'Service', |
|
| 225 | - ucfirst($modelNameSingular) . 'ServiceInterface', |
|
| 226 | - ucfirst($modelNameSingular) . 'Repository', |
|
| 227 | - ucfirst($modelNameSingular) . 'RepositoryInterface', |
|
| 228 | - ucfirst($modelName) . 'Errors', |
|
| 229 | - 'Store' . ucfirst($modelNameSingular), |
|
| 221 | + ucfirst($modelName).'DatabaseSeeder', |
|
| 222 | + ucfirst($modelName).'TableSeeder', |
|
| 223 | + ucfirst($modelNameSingular).'Controller', |
|
| 224 | + ucfirst($modelNameSingular).'Service', |
|
| 225 | + ucfirst($modelNameSingular).'ServiceInterface', |
|
| 226 | + ucfirst($modelNameSingular).'Repository', |
|
| 227 | + ucfirst($modelNameSingular).'RepositoryInterface', |
|
| 228 | + ucfirst($modelName).'Errors', |
|
| 229 | + 'Store'.ucfirst($modelNameSingular), |
|
| 230 | 230 | ucfirst($modelNameSingular), |
| 231 | - ucfirst($modelNameSingular) . 'Observer', |
|
| 231 | + ucfirst($modelNameSingular).'Observer', |
|
| 232 | 232 | Str::snake($modelName), |
| 233 | 233 | $modelName, |
| 234 | 234 | ]; |
@@ -252,6 +252,6 @@ discard block |
||
| 252 | 252 | $modelName = $this->container['slug']; |
| 253 | 253 | $migrationName = Str::camel($modelName); |
| 254 | 254 | $migrationName = Str::snake($migrationName); |
| 255 | - return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_' . $migrationName . '_table']); |
|
| 255 | + return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_'.$migrationName.'_table']); |
|
| 256 | 256 | } |
| 257 | 257 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]); |
| 34 | 34 | $oauthClient = \Core::oauthCLients()->first(['password_client' => 1]); |
| 35 | - if (! $oauthClient) { |
|
| 35 | + if (!$oauthClient) { |
|
| 36 | 36 | $oauthClient = $client->createPasswordGrantClient( |
| 37 | 37 | null, |
| 38 | 38 | config('app.name'), |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $translatable = $this->repo->model->translatable ?? []; |
| 44 | 44 | $filters = $this->constructFilters($conditions, $local); |
| 45 | - $sortBy = in_array($sortBy, $translatable) ? $sortBy . '->' . $local : $sortBy; |
|
| 45 | + $sortBy = in_array($sortBy, $translatable) ? $sortBy.'->'.$local : $sortBy; |
|
| 46 | 46 | |
| 47 | 47 | if ($trashed) { |
| 48 | 48 | return $this->deleted(['and' => $filters], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | /** |
| 214 | 214 | * Prepare key based on the the requested lang if it was translatable. |
| 215 | 215 | */ |
| 216 | - $key = in_array($key, $translatable) ? $key . '->' . $local : $key; |
|
| 216 | + $key = in_array($key, $translatable) ? $key.'->'.$local : $key; |
|
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | 219 | * Convert 0/1 or true/false to boolean in case of not foreign key. |
@@ -248,11 +248,11 @@ discard block |
||
| 248 | 248 | * Default string filteration. |
| 249 | 249 | */ |
| 250 | 250 | } elseif ($value) { |
| 251 | - $key = 'LOWER(' . $key . ')'; |
|
| 251 | + $key = 'LOWER('.$key.')'; |
|
| 252 | 252 | $value = strtolower($value); |
| 253 | 253 | $filters[$key] = [ |
| 254 | 254 | 'op' => 'like', |
| 255 | - 'val' => '%' . $value . '%' |
|
| 255 | + 'val' => '%'.$value.'%' |
|
| 256 | 256 | ]; |
| 257 | 257 | } |
| 258 | 258 | } |