@@ -11,6 +11,6 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Broadcast::channel('users.{id}', function ($user, $id) { |
|
14 | +Broadcast::channel('users.{id}', function($user, $id) { |
|
15 | 15 | return (int) $user->id === (int) $id; |
16 | 16 | }); |
@@ -63,7 +63,7 @@ |
||
63 | 63 | return \Response::json(['errors' => [$errors]], $exception->getStatusCode()); |
64 | 64 | } elseif ($exception instanceof \Illuminate\Validation\ValidationException) { |
65 | 65 | return \Response::json(['errors' => $exception->errors()], 422); |
66 | - } elseif (! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) { |
|
66 | + } elseif ( ! $exception instanceof \Symfony\Component\ErrorHandler\Error\FatalError) { |
|
67 | 67 | return parent::render($request, $exception); |
68 | 68 | } |
69 | 69 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | { |
26 | 26 | $this->registerPolicies(); |
27 | 27 | |
28 | - Passport::routes(function ($router) { |
|
28 | + Passport::routes(function($router) { |
|
29 | 29 | $router->forAuthorization(); |
30 | 30 | $router->forAccessTokens(); |
31 | 31 | $router->forPersonalAccessTokens(); |
@@ -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, $skipLoginCheck, $permission) { |
|
59 | + if ( ! in_array($permission, $skipLoginCheck)) { |
|
60 | + $this->authMiddleware->handle($request, function($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $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 | } |
@@ -28,27 +28,27 @@ |
||
28 | 28 | public function register() |
29 | 29 | { |
30 | 30 | //Bind Core Facade to the Service Container |
31 | - $this->app->singleton('Core', function () { |
|
31 | + $this->app->singleton('Core', function() { |
|
32 | 32 | return new \App\Modules\Core\Core; |
33 | 33 | }); |
34 | 34 | |
35 | 35 | //Bind Errors Facade to the Service Container |
36 | - $this->app->singleton('Errors', function () { |
|
36 | + $this->app->singleton('Errors', function() { |
|
37 | 37 | return new \App\Modules\Core\Utl\Errors; |
38 | 38 | }); |
39 | 39 | |
40 | 40 | //Bind CoreConfig Facade to the Service Container |
41 | - $this->app->singleton('CoreConfig', function () { |
|
41 | + $this->app->singleton('CoreConfig', function() { |
|
42 | 42 | return new \App\Modules\Core\Utl\CoreConfig; |
43 | 43 | }); |
44 | 44 | |
45 | 45 | //Bind Media Facade to the Service Container |
46 | - $this->app->singleton('Media', function () { |
|
46 | + $this->app->singleton('Media', function() { |
|
47 | 47 | return new \App\Modules\Core\Utl\Media; |
48 | 48 | }); |
49 | 49 | |
50 | 50 | //Bind ApiConsumer Facade to the Service Container |
51 | - $this->app->singleton('ApiConsumer', function () { |
|
51 | + $this->app->singleton('ApiConsumer', function() { |
|
52 | 52 | $app = app(); |
53 | 53 | return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
54 | 54 | }); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->container['slug'] = Str::slug($this->argument('slug')); |
90 | 90 | $this->container['name'] = Str::studly($this->container['slug']); |
91 | 91 | $this->container['version'] = '1.0'; |
92 | - $this->container['description'] = 'This is the description for the ' . $this->container['name'] . ' module.'; |
|
92 | + $this->container['description'] = 'This is the description for the '.$this->container['name'].' module.'; |
|
93 | 93 | $this->container['location'] = config('modules.default_location'); |
94 | 94 | $this->container['provider'] = config("modules.locations.{$this->container['location']}.provider"); |
95 | 95 | $this->container['basename'] = Str::studly($this->container['slug']); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $progress->finish(); |
124 | 124 | |
125 | - event($this->container['slug'] . '.module.made'); |
|
125 | + event($this->container['slug'].'.module.made'); |
|
126 | 126 | |
127 | 127 | $this->info("\nModule generated successfully."); |
128 | 128 | } |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | $manifest = config("modules.locations.$location.manifest") ?: 'module.json'; |
138 | 138 | $provider = config("modules.locations.$location.provider") ?: 'ModuleServiceProvider'; |
139 | 139 | |
140 | - if (!$this->files->isDirectory($root)) { |
|
140 | + if ( ! $this->files->isDirectory($root)) { |
|
141 | 141 | $this->files->makeDirectory($root); |
142 | 142 | } |
143 | 143 | |
144 | 144 | $directory = module_path(null, $this->container['basename'], $location); |
145 | - $source = __DIR__ . '/Stubs/Module'; |
|
145 | + $source = __DIR__.'/Stubs/Module'; |
|
146 | 146 | |
147 | 147 | $this->files->makeDirectory($directory); |
148 | 148 | |
149 | 149 | $sourceFiles = $this->files->allFiles($source, true); |
150 | 150 | |
151 | - if (!empty($this->mapping)) { |
|
151 | + if ( ! empty($this->mapping)) { |
|
152 | 152 | $search = array_keys($this->mapping); |
153 | 153 | $replace = array_values($this->mapping); |
154 | 154 | } |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | $contents = $this->replacePlaceholders($file->getContents()); |
158 | 158 | $subPath = $file->getRelativePathname(); |
159 | 159 | |
160 | - if (!empty($this->mapping)) { |
|
160 | + if ( ! empty($this->mapping)) { |
|
161 | 161 | $subPath = str_replace($search, $replace, $subPath); |
162 | 162 | } |
163 | 163 | |
164 | - $filePath = $directory . '/' . $subPath; |
|
164 | + $filePath = $directory.'/'.$subPath; |
|
165 | 165 | |
166 | 166 | // if the file is module.json, replace it with the custom manifest file name |
167 | 167 | if ($file->getFilename() === 'module.json' && $manifest) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $dir = dirname($filePath); |
178 | 178 | |
179 | - if (! $this->files->isDirectory($dir)) { |
|
179 | + if ( ! $this->files->isDirectory($dir)) { |
|
180 | 180 | $this->files->makeDirectory($dir, 0755, true); |
181 | 181 | } |
182 | 182 | |
@@ -209,20 +209,20 @@ discard block |
||
209 | 209 | ]; |
210 | 210 | |
211 | 211 | $replace = [ |
212 | - ucfirst($modelNameSingular) . 'Factory', |
|
212 | + ucfirst($modelNameSingular).'Factory', |
|
213 | 213 | $modelNameSingular, |
214 | 214 | $this->container['slug'], |
215 | 215 | ucfirst($modelName), |
216 | 216 | ucfirst($modelNameSingular), |
217 | - ucfirst($modelName) . 'DatabaseSeeder', |
|
218 | - ucfirst($modelName) . 'TableSeeder', |
|
219 | - ucfirst($modelNameSingular) . 'Controller', |
|
220 | - ucfirst($modelNameSingular) . 'Service', |
|
221 | - ucfirst($modelNameSingular) . 'Repository', |
|
222 | - 'Insert' . ucfirst($modelNameSingular), |
|
223 | - 'Update' . ucfirst($modelNameSingular), |
|
217 | + ucfirst($modelName).'DatabaseSeeder', |
|
218 | + ucfirst($modelName).'TableSeeder', |
|
219 | + ucfirst($modelNameSingular).'Controller', |
|
220 | + ucfirst($modelNameSingular).'Service', |
|
221 | + ucfirst($modelNameSingular).'Repository', |
|
222 | + 'Insert'.ucfirst($modelNameSingular), |
|
223 | + 'Update'.ucfirst($modelNameSingular), |
|
224 | 224 | ucfirst($modelNameSingular), |
225 | - ucfirst($modelNameSingular) . 'Observer', |
|
225 | + ucfirst($modelNameSingular).'Observer', |
|
226 | 226 | $modelName, |
227 | 227 | $modelName, |
228 | 228 | ]; |
@@ -244,6 +244,6 @@ discard block |
||
244 | 244 | protected function generateMigration() |
245 | 245 | { |
246 | 246 | $modelName = $this->container['slug']; |
247 | - return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_' . $modelName . '_table']); |
|
247 | + return $this->callSilent('make:module:migration', ['slug' => $modelName, 'name' => 'create_'.$modelName.'_table']); |
|
248 | 248 | } |
249 | 249 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function __construct($model) |
21 | 21 | { |
22 | - $this->model = $model; |
|
22 | + $this->model = $model; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * Construct the select conditions for the model. |
84 | 84 | */ |
85 | - $model->where(function ($q) use ($query, $conditionColumns, $relations) { |
|
85 | + $model->where(function($q) use ($query, $conditionColumns, $relations) { |
|
86 | 86 | |
87 | 87 | if (count($conditionColumns)) { |
88 | 88 | $column = 'LOWER('.array_shift($conditionColumns).')'; |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * Construct the relation condition. |
126 | 126 | */ |
127 | - $q->orWhereHas($relation, function ($subModel) use ($query, $relation) { |
|
127 | + $q->orWhereHas($relation, function($subModel) use ($query, $relation) { |
|
128 | 128 | |
129 | - $subModel->where(function ($q) use ($query, $relation) { |
|
129 | + $subModel->where(function($q) use ($query, $relation) { |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Get columns of the relation. |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $model = false; |
213 | 213 | $relations = []; |
214 | 214 | |
215 | - \DB::transaction(function () use (&$model, $relations, $data) { |
|
215 | + \DB::transaction(function() use (&$model, $relations, $data) { |
|
216 | 216 | |
217 | 217 | $model = $this->prepareModel($data); |
218 | 218 | $relations = $this->prepareRelations($data, $model); |
@@ -233,17 +233,17 @@ discard block |
||
233 | 233 | public function delete($value, $attribute = 'id') |
234 | 234 | { |
235 | 235 | if ($attribute == 'id') { |
236 | - \DB::transaction(function () use ($value) { |
|
236 | + \DB::transaction(function() use ($value) { |
|
237 | 237 | $model = $this->model->lockForUpdate()->find($value); |
238 | - if (! $model) { |
|
238 | + if ( ! $model) { |
|
239 | 239 | \Errors::notFound(class_basename($this->model).' with id : '.$value); |
240 | 240 | } |
241 | 241 | |
242 | 242 | $model->delete(); |
243 | 243 | }); |
244 | 244 | } else { |
245 | - \DB::transaction(function () use ($value, $attribute) { |
|
246 | - $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function ($model) { |
|
245 | + \DB::transaction(function() use ($value, $attribute) { |
|
246 | + $this->model->where($attribute, '=', $value)->lockForUpdate()->get()->each(function($model) { |
|
247 | 247 | $model->delete(); |
248 | 248 | }); |
249 | 249 | }); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | { |
335 | 335 | $model = $this->model->onlyTrashed()->find($id); |
336 | 336 | |
337 | - if (! $model) { |
|
337 | + if ( ! $model) { |
|
338 | 338 | \Errors::notFound(class_basename($this->model).' with id : '.$id); |
339 | 339 | } |
340 | 340 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @var array |
359 | 359 | */ |
360 | 360 | $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass; |
361 | - if (! $model) { |
|
361 | + if ( ! $model) { |
|
362 | 362 | \Errors::notFound(class_basename($modelClass).' with id : '.$data['id']); |
363 | 363 | } |
364 | 364 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * If the relation has no value then marke the relation data |
409 | 409 | * related to the model to be deleted. |
410 | 410 | */ |
411 | - if (! $value || ! count($value)) { |
|
411 | + if ( ! $value || ! count($value)) { |
|
412 | 412 | $relations[$relation] = 'delete'; |
413 | 413 | } |
414 | 414 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | /** |
436 | 436 | * If model doesn't exists. |
437 | 437 | */ |
438 | - if (! $relationModel) { |
|
438 | + if ( ! $relationModel) { |
|
439 | 439 | \Errors::notFound(class_basename($relationBaseModel).' with id : '.$val['id']); |
440 | 440 | } |
441 | 441 | |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | /** |
467 | 467 | * If model doesn't exists. |
468 | 468 | */ |
469 | - if (! $relationModel) { |
|
469 | + if ( ! $relationModel) { |
|
470 | 470 | \Errors::notFound(class_basename($relationBaseModel).' with id : '.$value['id']); |
471 | 471 | } |
472 | 472 | |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | $value = $removeLast === false ? $value : substr($value, 0, $removeLast); |
673 | 673 | $path = explode('->', $value); |
674 | 674 | $field = array_shift($path); |
675 | - $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) { |
|
675 | + $result = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function($part) { |
|
676 | 676 | return '"'.$part.'"'; |
677 | 677 | })->implode('.')); |
678 | 678 |
@@ -74,7 +74,7 @@ |
||
74 | 74 | if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
75 | 75 | $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
76 | 76 | $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
77 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
77 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
78 | 78 | return call_user_func_array([$this->repo, $name], $arguments); |
79 | 79 | }); |
80 | 80 | } elseif ($this->cacheConfig && $this->cacheConfig == 'clear') { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | $response = \ApiConsumer::post('/oauth/token', $data); |
51 | 51 | |
52 | - if (! $response->isSuccessful()) { |
|
52 | + if ( ! $response->isSuccessful()) { |
|
53 | 53 | if ($grantType == 'refresh_token') { |
54 | 54 | \Errors::invalidRefreshToken(); |
55 | 55 | } |