@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('oauth_clients', function (Blueprint $table) { |
|
| 16 | + Schema::create('oauth_clients', function(Blueprint $table) { |
|
| 17 | 17 | increments('id'); |
| 18 | 18 | $table->unsignedInteger('user_id')->nullable(); |
| 19 | 19 | $table->string('name'); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | $permission = $routeActions[1]; |
| 57 | 57 | |
| 58 | 58 | $this->auth->shouldUse('api'); |
| 59 | - if (! in_array($permission, $skipLoginCheck)) { |
|
| 60 | - $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $permission) { |
|
| 59 | + if ( ! in_array($permission, $skipLoginCheck)) { |
|
| 60 | + $this->authMiddleware->handle($request, function($request) use ($modelName, $skipPermissionCheck, $permission) { |
|
| 61 | 61 | $user = $this->auth->user(); |
| 62 | 62 | $isPasswordClient = $user->token()->client->password_client; |
| 63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
| 69 | - } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
| 69 | + } elseif ( ! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
| 70 | 70 | } else { |
| 71 | 71 | \Errors::noPermissions(); |
| 72 | 72 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct($model) |
| 23 | 23 | { |
| 24 | - $this->model = $model; |
|
| 24 | + $this->model = $model; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $model = false; |
| 99 | 99 | $relations = []; |
| 100 | 100 | |
| 101 | - \DB::transaction(function () use (&$model, &$relations, $data) { |
|
| 101 | + \DB::transaction(function() use (&$model, &$relations, $data) { |
|
| 102 | 102 | |
| 103 | 103 | $model = $this->prepareModel($data); |
| 104 | 104 | $relations = $this->prepareRelations($data, $model); |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function delete($value, $attribute = 'id') |
| 124 | 124 | { |
| 125 | - \DB::transaction(function () use ($value, $attribute) { |
|
| 126 | - $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function ($model) { |
|
| 125 | + \DB::transaction(function() use ($value, $attribute) { |
|
| 126 | + $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function($model) { |
|
| 127 | 127 | $model->delete(); |
| 128 | 128 | }); |
| 129 | 129 | }); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | { |
| 214 | 214 | $model = $this->model->onlyTrashed()->find($id); |
| 215 | 215 | |
| 216 | - if (! $model) { |
|
| 216 | + if ( ! $model) { |
|
| 217 | 217 | \Errors::notFound(class_basename($this->model).' with id : '.$id); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * @var array |
| 238 | 238 | */ |
| 239 | 239 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
| 240 | - if (! $model) { |
|
| 240 | + if ( ! $model) { |
|
| 241 | 241 | \Errors::notFound(class_basename($modelClass).' with id : '.$data['id']); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * If the relation has no value then marke the relation data |
| 295 | 295 | * related to the model to be deleted. |
| 296 | 296 | */ |
| 297 | - if (! $value || ! count($value)) { |
|
| 297 | + if ( ! $value || ! count($value)) { |
|
| 298 | 298 | $relations[$relation] = 'delete'; |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | /** |
| 322 | 322 | * If model doesn't exists. |
| 323 | 323 | */ |
| 324 | - if (! $relationModel) { |
|
| 324 | + if ( ! $relationModel) { |
|
| 325 | 325 | \Errors::notFound(class_basename($relationBaseModel).' with id : '.$val['id']); |
| 326 | 326 | } |
| 327 | 327 | |
@@ -334,12 +334,12 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | if (gettype($val) !== 'object' && gettype($val) !== 'array' && array_search($attr, $relationModel->getFillable(), true) !== false) { |
| 336 | 336 | $relationModel->$attr = $val; |
| 337 | - } elseif(gettype($val) !== 'object' && gettype($val) !== 'array' && $attr !== 'id') { |
|
| 337 | + } elseif (gettype($val) !== 'object' && gettype($val) !== 'array' && $attr !== 'id') { |
|
| 338 | 338 | $extra[$attr] = $val; |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if(isset($extra)) $relationModel->extra = $extra; |
|
| 342 | + if (isset($extra)) $relationModel->extra = $extra; |
|
| 343 | 343 | $relations[$relation][] = $relationModel; |
| 344 | 344 | } else { |
| 345 | 345 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | /** |
| 356 | 356 | * If model doesn't exists. |
| 357 | 357 | */ |
| 358 | - if (! $relationModel) { |
|
| 358 | + if ( ! $relationModel) { |
|
| 359 | 359 | \Errors::notFound(class_basename($relationBaseModel).' with id : '.$value['id']); |
| 360 | 360 | } |
| 361 | 361 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | $value = $removeLast === false ? $value : substr($value, 0, $removeLast); |
| 564 | 564 | $path = explode('->', $value); |
| 565 | 565 | $field = array_shift($path); |
| 566 | - $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { |
|
| 566 | + $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function($part) { |
|
| 567 | 567 | return '"'.$part.'"'; |
| 568 | 568 | })->implode('.')); |
| 569 | 569 | |
@@ -38,13 +38,13 @@ |
||
| 38 | 38 | $filters = []; |
| 39 | 39 | $translatable = $this->repo->model->translatable ?? []; |
| 40 | 40 | foreach ($conditions as $key => $value) { |
| 41 | - if($value && in_array($key, $this->repo->model->fillable ?? [])) { |
|
| 42 | - $key = in_array($key, $translatable) ? $key . '->' . (\Session::get('locale') == 'all' ? 'en' : \Session::get('locale')) : $key; |
|
| 41 | + if ($value && in_array($key, $this->repo->model->fillable ?? [])) { |
|
| 42 | + $key = in_array($key, $translatable) ? $key.'->'.(\Session::get('locale') == 'all' ? 'en' : \Session::get('locale')) : $key; |
|
| 43 | 43 | $isBool = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== null; |
| 44 | 44 | $filters[$key] = $isBool ? filter_var($value, FILTER_VALIDATE_BOOLEAN) : $value; |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - $sortBy = in_array($sortBy, $translatable) ? $sortBy . '->' . \Session::get('locale') : $sortBy; |
|
| 47 | + $sortBy = in_array($sortBy, $translatable) ? $sortBy.'->'.\Session::get('locale') : $sortBy; |
|
| 48 | 48 | |
| 49 | 49 | if ($trashed) { |
| 50 | 50 | return $this->deleted(['and' => $filters], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('settings', function (Blueprint $table) { |
|
| 15 | + Schema::create('settings', function(Blueprint $table) { |
|
| 16 | 16 | increments('id'); |
| 17 | 17 | $table->string('name', 100); |
| 18 | 18 | $table->string('key', 100)->unique(); |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
| 77 | 77 | $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
| 78 | 78 | $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
| 79 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
| 79 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
| 80 | 80 | return call_user_func_array([$this->service, $name], $arguments); |
| 81 | 81 | }); |
| 82 | 82 | } elseif ($this->cacheConfig) { |
@@ -26,11 +26,11 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function uploadImageBas64($image, $dir) |
| 28 | 28 | { |
| 29 | - if (! strlen($image)) { |
|
| 29 | + if ( ! strlen($image)) { |
|
| 30 | 30 | return null; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if(filter_var($image, FILTER_VALIDATE_URL)) { |
|
| 33 | + if (filter_var($image, FILTER_VALIDATE_URL)) { |
|
| 34 | 34 | return $image; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $this->container['slug'] = Str::slug($this->argument('slug')); |
| 91 | 91 | $this->container['name'] = Str::studly($this->container['slug']); |
| 92 | 92 | $this->container['version'] = '1.0'; |
| 93 | - $this->container['description'] = 'This is the description for the ' . $this->container['name'] . ' module.'; |
|
| 93 | + $this->container['description'] = 'This is the description for the '.$this->container['name'].' module.'; |
|
| 94 | 94 | $this->container['location'] = config('modules.default_location'); |
| 95 | 95 | $this->container['provider'] = config("modules.locations.{$this->container['location']}.provider"); |
| 96 | 96 | $this->container['basename'] = Str::studly($this->container['slug']); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $progress->finish(); |
| 125 | 125 | |
| 126 | - event($this->container['slug'] . '.module.made'); |
|
| 126 | + event($this->container['slug'].'.module.made'); |
|
| 127 | 127 | |
| 128 | 128 | $this->info("\nModule generated successfully."); |
| 129 | 129 | } |
@@ -138,18 +138,18 @@ discard block |
||
| 138 | 138 | $manifest = config("modules.locations.$location.manifest") ?: 'module.json'; |
| 139 | 139 | $provider = config("modules.locations.$location.provider") ?: 'ModuleServiceProvider'; |
| 140 | 140 | |
| 141 | - if (!$this->files->isDirectory($root)) { |
|
| 141 | + if ( ! $this->files->isDirectory($root)) { |
|
| 142 | 142 | $this->files->makeDirectory($root); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $directory = module_path(null, $this->container['basename'], $location); |
| 146 | - $source = __DIR__ . '/Stubs/Module'; |
|
| 146 | + $source = __DIR__.'/Stubs/Module'; |
|
| 147 | 147 | |
| 148 | 148 | $this->files->makeDirectory($directory); |
| 149 | 149 | |
| 150 | 150 | $sourceFiles = $this->files->allFiles($source, true); |
| 151 | 151 | |
| 152 | - if (!empty($this->mapping)) { |
|
| 152 | + if ( ! empty($this->mapping)) { |
|
| 153 | 153 | $search = array_keys($this->mapping); |
| 154 | 154 | $replace = array_values($this->mapping); |
| 155 | 155 | } |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | $contents = $this->replacePlaceholders($file->getContents()); |
| 159 | 159 | $subPath = $file->getRelativePathname(); |
| 160 | 160 | |
| 161 | - if (!empty($this->mapping)) { |
|
| 161 | + if ( ! empty($this->mapping)) { |
|
| 162 | 162 | $subPath = str_replace($search, $replace, $subPath); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $filePath = $directory . '/' . $subPath; |
|
| 165 | + $filePath = $directory.'/'.$subPath; |
|
| 166 | 166 | |
| 167 | 167 | // if the file is module.json, replace it with the custom manifest file name |
| 168 | 168 | if ($file->getFilename() === 'module.json' && $manifest) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $dir = dirname($filePath); |
| 179 | 179 | |
| 180 | - if (! $this->files->isDirectory($dir)) { |
|
| 180 | + if ( ! $this->files->isDirectory($dir)) { |
|
| 181 | 181 | $this->files->makeDirectory($dir, 0755, true); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -210,20 +210,20 @@ discard block |
||
| 210 | 210 | ]; |
| 211 | 211 | |
| 212 | 212 | $replace = [ |
| 213 | - ucfirst($modelNameSingular) . 'Factory', |
|
| 213 | + ucfirst($modelNameSingular).'Factory', |
|
| 214 | 214 | $modelNameSingular, |
| 215 | 215 | $this->container['slug'], |
| 216 | 216 | ucfirst($modelName), |
| 217 | 217 | ucfirst($modelNameSingular), |
| 218 | - ucfirst($modelName) . 'DatabaseSeeder', |
|
| 219 | - ucfirst($modelName) . 'TableSeeder', |
|
| 220 | - ucfirst($modelNameSingular) . 'Controller', |
|
| 221 | - ucfirst($modelNameSingular) . 'Service', |
|
| 222 | - ucfirst($modelNameSingular) . 'Repository', |
|
| 223 | - ucfirst($modelName) . 'Errors', |
|
| 224 | - 'Store' . ucfirst($modelNameSingular), |
|
| 218 | + ucfirst($modelName).'DatabaseSeeder', |
|
| 219 | + ucfirst($modelName).'TableSeeder', |
|
| 220 | + ucfirst($modelNameSingular).'Controller', |
|
| 221 | + ucfirst($modelNameSingular).'Service', |
|
| 222 | + ucfirst($modelNameSingular).'Repository', |
|
| 223 | + ucfirst($modelName).'Errors', |
|
| 224 | + 'Store'.ucfirst($modelNameSingular), |
|
| 225 | 225 | ucfirst($modelNameSingular), |
| 226 | - ucfirst($modelNameSingular) . 'Observer', |
|
| 226 | + ucfirst($modelNameSingular).'Observer', |
|
| 227 | 227 | \Str::snake($modelName), |
| 228 | 228 | $modelName, |
| 229 | 229 | ]; |
@@ -247,6 +247,6 @@ discard block |
||
| 247 | 247 | $modelName = $this->container['slug']; |
| 248 | 248 | $migrationName = \Str::camel($modelName); |
| 249 | 249 | $migrationName = \Str::snake($migrationName); |
| 250 | - return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_' . $migrationName . '_table']); |
|
| 250 | + return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_'.$migrationName.'_table']); |
|
| 251 | 251 | } |
| 252 | 252 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | protected function getRoutes() |
| 94 | 94 | { |
| 95 | - return collect(\Route::getRoutes())->map(function ($route) { |
|
| 95 | + return collect(\Route::getRoutes())->map(function($route) { |
|
| 96 | 96 | if (strpos($route->uri(), 'api/') !== false) { |
| 97 | 97 | return [ |
| 98 | 98 | 'method' => $route->methods()[0], |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | ]; |
| 124 | 124 | |
| 125 | 125 | |
| 126 | - if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
| 126 | + if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) { |
|
| 127 | 127 | $route['headers']['Authorization'] = 'Bearer {token}'; |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if ($className) { |
| 182 | 182 | $reflectionClass = new \ReflectionClass($className); |
| 183 | 183 | } elseif (in_array($reflectionMethod->getName(), ['store', 'update'])) { |
| 184 | - $className = 'App\\Modules\\' . ucfirst($module) . '\\Http\\Requests\\Store' . ucfirst($modelName); |
|
| 184 | + $className = 'App\\Modules\\'.ucfirst($module).'\\Http\\Requests\\Store'.ucfirst($modelName); |
|
| 185 | 185 | $reflectionClass = new \ReflectionClass($className); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | $errors = []; |
| 210 | 210 | foreach (\Module::all() as $module) { |
| 211 | - $nameSpace = 'App\\Modules\\' . $module['basename']; |
|
| 212 | - $class = $nameSpace . '\\Errors\\' . $module['basename'] . 'Errors'; |
|
| 211 | + $nameSpace = 'App\\Modules\\'.$module['basename']; |
|
| 212 | + $class = $nameSpace.'\\Errors\\'.$module['basename'].'Errors'; |
|
| 213 | 213 | $reflectionClass = new \ReflectionClass($class); |
| 214 | 214 | foreach ($reflectionClass->getMethods() as $method) { |
| 215 | 215 | $methodName = $method->name; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | { |
| 258 | 258 | if ($modelName && ! Arr::has($docData['models'], $modelName)) { |
| 259 | 259 | $repo = call_user_func_array("\Core::{$modelName}", []); |
| 260 | - if (! $repo) { |
|
| 260 | + if ( ! $repo) { |
|
| 261 | 261 | return; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $body = $this->getMethodBody($reflectionMethod); |
| 276 | 276 | foreach ($relationMethods as $relationMethod) { |
| 277 | 277 | $relation = $reflectionMethod->getName(); |
| 278 | - if (strpos($body, '$this->' . $relationMethod) && $relation !== 'morphedByMany') { |
|
| 278 | + if (strpos($body, '$this->'.$relationMethod) && $relation !== 'morphedByMany') { |
|
| 279 | 279 | $relations[] = $relation; |
| 280 | 280 | break; |
| 281 | 281 | } |