Passed
Pull Request — 2.x (#1042)
by Antonio Carlos
06:10
created
src/Http/Controllers/Admin/DashboardController.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
     {
109 109
         $modules = Collection::make($this->config->get('twill.dashboard.modules'));
110 110
 
111
-        return $modules->filter(function ($module) {
111
+        return $modules->filter(function($module) {
112 112
             return ($module['search'] ?? false);
113
-        })->map(function ($module) use ($request) {
113
+        })->map(function($module) use ($request) {
114 114
             $repository = $this->getRepository($module['name'], $module['repository'] ?? null);
115 115
 
116 116
             $found = $repository->cmsSearch($request->get('search'), $module['search_fields'] ?? ['title'])->take(10);
117 117
 
118
-            return $found->map(function ($item) use ($module) {
118
+            return $found->map(function($item) use ($module) {
119 119
                 try {
120 120
                     $author = $item->revisions()->latest()->first()->user->name ?? 'Admin';
121 121
                 } catch (\Exception $e) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     private function getAllActivities()
144 144
     {
145
-        return Activity::take(20)->latest()->get()->map(function ($activity) {
145
+        return Activity::take(20)->latest()->get()->map(function($activity) {
146 146
             return $this->formatActivity($activity);
147 147
         })->filter()->values();
148 148
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     private function getLoggedInUserActivities()
154 154
     {
155
-        return Activity::where('causer_id', $this->authFactory->guard('twill_users')->user()->id)->take(20)->latest()->get()->map(function ($activity) {
155
+        return Activity::where('causer_id', $this->authFactory->guard('twill_users')->user()->id)->take(20)->latest()->get()->map(function($activity) {
156 156
             return $this->formatActivity($activity);
157 157
         })->filter()->values();
158 158
     }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             'date' => $activity->created_at->toIso8601String(),
180 180
             'author' => $activity->causer->name ?? twillTrans('twill::lang.dashboard.unkown-author'),
181 181
             'name' => $activity->subject->titleInDashboard ?? $activity->subject->title,
182
-            'activity' => twillTrans('twill::lang.dashboard.activities.'.$activity->description),
182
+            'activity' => twillTrans('twill::lang.dashboard.activities.' . $activity->description),
183 183
         ] + (classHasTrait($activity->subject, HasMedias::class) ? [
184 184
             'thumbnail' => $activity->subject->defaultCmsImage(['w' => 100, 'h' => 100]),
185 185
         ] : []) + (!$activity->subject->trashed() ? [
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             return [];
206 206
         }
207 207
 
208
-        $statsByDate = Collection::make($response['rows'] ?? [])->map(function (array $dateRow) {
208
+        $statsByDate = Collection::make($response['rows'] ?? [])->map(function(array $dateRow) {
209 209
             return [
210 210
                 'date' => $dateRow[0],
211 211
                 'users' => (int) $dateRow[1],
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             'yesterday',
221 221
             'week',
222 222
             'month',
223
-        ])->mapWithKeys(function ($period) use ($statsByDate) {
223
+        ])->mapWithKeys(function($period) use ($statsByDate) {
224 224
             $stats = $this->getPeriodStats($period, $statsByDate);
225 225
             return [
226 226
                 $period => [
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
                 'stats' => $stats = $statsByDate->first(),
258 258
                 'moreUsers' => $stats['users'] > $statsByDate->get(1)['users'],
259 259
                 'morePageViews' => $stats['pageViews'] > $statsByDate->get(1)['pageViews'],
260
-                'usersData' => $statsByDate->take(7)->map(function ($stat) {
260
+                'usersData' => $statsByDate->take(7)->map(function($stat) {
261 261
                     return $stat['users'];
262 262
                 }),
263
-                'pageViewsData' => $statsByDate->take(7)->map(function ($stat) {
263
+                'pageViewsData' => $statsByDate->take(7)->map(function($stat) {
264 264
                     return $stat['pageViews'];
265 265
                 }),
266 266
             ];
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
                 'stats' => $stats = $statsByDate->get(1),
270 270
                 'moreUsers' => $stats['users'] > $statsByDate->get(2)['users'],
271 271
                 'morePageViews' => $stats['pageViews'] > $statsByDate->get(2)['pageViews'],
272
-                'usersData' => $statsByDate->slice(1)->take(7)->map(function ($stat) {
272
+                'usersData' => $statsByDate->slice(1)->take(7)->map(function($stat) {
273 273
                     return $stat['users'];
274 274
                 }),
275
-                'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function ($stat) {
275
+                'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function($stat) {
276 276
                     return $stat['pageViews'];
277 277
                 }),
278 278
             ];
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
                 'stats' => $stats,
296 296
                 'moreUsers' => $stats['users'] > $compareStats['users'],
297 297
                 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'],
298
-                'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) {
298
+                'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) {
299 299
                     return $stat['users'];
300 300
                 }),
301
-                'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) {
301
+                'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) {
302 302
                     return $stat['pageViews'];
303 303
                 }),
304 304
             ];
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
                 'stats' => $stats,
322 322
                 'moreUsers' => $stats['users'] > $compareStats['users'],
323 323
                 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'],
324
-                'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) {
324
+                'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) {
325 325
                     return $stat['users'];
326 326
                 }),
327
-                'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) {
327
+                'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) {
328 328
                     return $stat['pageViews'];
329 329
                 }),
330 330
             ];
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
      */
351 351
     private function getShortcuts($modules)
352 352
     {
353
-        return $modules->filter(function ($module) {
353
+        return $modules->filter(function($module) {
354 354
             return ($module['count'] ?? false) || ($module['create'] ?? false);
355
-        })->map(function ($module) {
355
+        })->map(function($module) {
356 356
             $repository = $this->getRepository($module['name'], $module['repository'] ?? null);
357 357
 
358 358
             $moduleOptions = [
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
      */
390 390
     private function getDrafts($modules)
391 391
     {
392
-        return $modules->filter(function ($module) {
392
+        return $modules->filter(function($module) {
393 393
             return ($module['draft'] ?? false);
394
-        })->map(function ($module) {
394
+        })->map(function($module) {
395 395
             $repository = $this->getRepository($module['name'], $module['repository'] ?? null);
396 396
 
397 397
             $query = $repository->draft()->limit(3)->latest();
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 
403 403
             $drafts = $query->get();
404 404
 
405
-            return $drafts->map(function ($draft) use ($module) {
405
+            return $drafts->map(function($draft) use ($module) {
406 406
                 return [
407 407
                     'type' => ucfirst($module['label_singular'] ?? Str::singular($module['name'])),
408 408
                     'name' => $draft->titleInDashboard ?? $draft->title,
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleBlocks.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $blockRepository = app(BlockRepository::class);
75 75
 
76 76
         $blockRepository->bulkDelete($object->blocks()->pluck('id')->toArray());
77
-        $this->getBlocks($object, $fields)->each(function ($block) use ($object, $blockRepository) {
77
+        $this->getBlocks($object, $fields)->each(function($block) use ($object, $blockRepository) {
78 78
             $this->createBlock($blockRepository, $block);
79 79
         });
80 80
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $blockCreated = $blockRepository->create($blockFields);
93 93
 
94 94
         // Handle child blocks
95
-        $blockFields['blocks']->each(function ($childBlock) use ($blockCreated, $blockRepository) {
95
+        $blockFields['blocks']->each(function($childBlock) use ($blockCreated, $blockRepository) {
96 96
             $childBlock['parent_id'] = $blockCreated->id;
97 97
             $this->createBlock($blockRepository, $childBlock);
98 98
         });
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
                     ];
204 204
                 }
205 205
 
206
-                $fields['blocksFields'][] = Collection::make($block['content'])->filter(function ($value, $key) {
206
+                $fields['blocksFields'][] = Collection::make($block['content'])->filter(function($value, $key) {
207 207
                     return $key !== "browsers";
208
-                })->map(function ($value, $key) use ($block) {
208
+                })->map(function($value, $key) use ($block) {
209 209
                     return [
210 210
                         'name' => "blocks[$block->id][$key]",
211 211
                         'value' => $value,
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 
219 219
                 if ($medias) {
220 220
                     if (config('twill.media_library.translated_form_fields', false)) {
221
-                        $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function ($mediasByLocale, $locale) use ($block) {
222
-                            return Collection::make($mediasByLocale)->mapWithKeys(function ($value, $key) use ($block, $locale) {
221
+                        $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function($mediasByLocale, $locale) use ($block) {
222
+                            return Collection::make($mediasByLocale)->mapWithKeys(function($value, $key) use ($block, $locale) {
223 223
                                 return [
224 224
                                     "blocks[$block->id][$key][$locale]" => $value,
225 225
                                 ];
226 226
                             });
227 227
                         })->filter()->toArray();
228 228
                     } else {
229
-                        $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function ($value, $key) use ($block) {
229
+                        $fields['blocksMedias'][] = Collection::make($medias)->mapWithKeys(function($value, $key) use ($block) {
230 230
                             return [
231 231
                                 "blocks[$block->id][$key]" => $value,
232 232
                             ];
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
                 $files = $blockFormFields['files'];
238 238
 
239 239
                 if ($files) {
240
-                    Collection::make($files)->each(function ($rolesWithFiles, $locale) use (&$fields, $block) {
241
-                        $fields['blocksFiles'][] = Collection::make($rolesWithFiles)->mapWithKeys(function ($files, $role) use ($locale, $block) {
240
+                    Collection::make($files)->each(function($rolesWithFiles, $locale) use (&$fields, $block) {
241
+                        $fields['blocksFiles'][] = Collection::make($rolesWithFiles)->mapWithKeys(function($files, $role) use ($locale, $block) {
242 242
                             return [
243 243
                                 "blocks[$block->id][$role][$locale]" => $files,
244 244
                             ];
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     protected function getBlockBrowsers($block)
279 279
     {
280
-        return Collection::make($block['content']['browsers'])->mapWithKeys(function ($ids, $relation) use ($block) {
280
+        return Collection::make($block['content']['browsers'])->mapWithKeys(function($ids, $relation) use ($block) {
281 281
             if (Schema::hasTable(config('twill.related_table', 'twill_related')) && $block->getRelated($relation)->isNotEmpty()) {
282 282
                 $items = $this->getFormFieldsForRelatedBrowser($block, $relation);
283 283
                 foreach ($items as &$item) {
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
                     $sortedRelatedItems[$item->id] = $item;
295 295
                 }
296 296
 
297
-                $items = Collection::make(array_values($sortedRelatedItems))->filter(function ($value) {
297
+                $items = Collection::make(array_values($sortedRelatedItems))->filter(function($value) {
298 298
                     return is_object($value);
299
-                })->map(function ($relatedElement) use ($relation) {
299
+                })->map(function($relatedElement) use ($relation) {
300 300
                     return [
301 301
                         'id' => $relatedElement->id,
302 302
                         'name' => $relatedElement->titleInBrowser ?? $relatedElement->title,
Please login to merge, or discard this patch.
src/Commands/GenerateBlocks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             ->collect()
72 72
             ->where('compiled', true)
73 73
             ->whereIn('source', [Block::SOURCE_APP, Block::SOURCE_CUSTOM])
74
-            ->map(function ($block) {
74
+            ->map(function($block) {
75 75
                 $blockName = str_replace('a17-block-', '', $block->component);
76 76
                 $basename = str_replace('.blade.php', '', $block->fileName);
77 77
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     $this->filesystem->put($vueBlockPath, $vueBlockContent);
94 94
                     $this->info("Block " . Str::title($blockName) . " generated successfully");
95 95
                 } else {
96
-                    $this->info("Skipping block " .  Str::title($blockName) . ".");
96
+                    $this->info("Skipping block " . Str::title($blockName) . ".");
97 97
                 }
98 98
             });
99 99
 
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/ModuleController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             "$this->viewPrefix.index",
356 356
             "twill::$this->moduleName.index",
357 357
             "twill::layouts.listing",
358
-        ])->first(function ($view) {
358
+        ])->first(function($view) {
359 359
             return View::exists($view);
360 360
         });
361 361
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
             "$this->viewPrefix.form",
461 461
             "twill::$this->moduleName.form",
462 462
             "twill::layouts.form",
463
-        ])->first(function ($view) {
463
+        ])->first(function($view) {
464 464
             return View::exists($view);
465 465
         });
466 466
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
             "$this->viewPrefix.form",
492 492
             "twill::$this->moduleName.form",
493 493
             "twill::layouts.form",
494
-        ])->first(function ($view) {
494
+        ])->first(function($view) {
495 495
             return View::exists($view);
496 496
         });
497 497
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
             "$this->viewPrefix.form",
616 616
             "twill::$this->moduleName.form",
617 617
             "twill::layouts.form",
618
-        ])->first(function ($view) {
618
+        ])->first(function($view) {
619 619
             return View::exists($view);
620 620
         });
621 621
 
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
         $query = $this->request->input('q');
864 864
         $tags = $this->repository->getTags($query);
865 865
 
866
-        return Response::json(['items' => $tags->map(function ($tag) {
866
+        return Response::json(['items' => $tags->map(function($tag) {
867 867
             return $tag->name;
868 868
         })], 200);
869 869
     }
@@ -951,8 +951,8 @@  discard block
 block discarded – undo
951 951
     protected function getIndexTableData($items)
952 952
     {
953 953
         $translated = $this->moduleHas('translations');
954
-        return $items->map(function ($item) use ($translated) {
955
-            $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function ($column) use ($item) {
954
+        return $items->map(function($item) use ($translated) {
955
+            $columnsData = Collection::make($this->indexColumns)->mapWithKeys(function($column) use ($item) {
956 956
                 return $this->getItemColumnData($item, $column);
957 957
             })->toArray();
958 958
 
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
             'feature',
1214 1214
             'bulkFeature',
1215 1215
             'bulkDelete',
1216
-        ])->mapWithKeys(function ($endpoint) {
1216
+        ])->mapWithKeys(function($endpoint) {
1217 1217
             return [
1218 1218
                 $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute(
1219 1219
                     $this->moduleName,
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
      */
1232 1232
     protected function getIndexOption($option)
1233 1233
     {
1234
-        return once(function () use ($option) {
1234
+        return once(function() use ($option) {
1235 1235
             $customOptionNamesMapping = [
1236 1236
                 'store' => 'create',
1237 1237
             ];
@@ -1288,8 +1288,8 @@  discard block
 block discarded – undo
1288 1288
     {
1289 1289
         $withImage = $this->moduleHas('medias');
1290 1290
 
1291
-        return $items->map(function ($item) use ($withImage) {
1292
-            $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function ($column) use ($item) {
1291
+        return $items->map(function($item) use ($withImage) {
1292
+            $columnsData = Collection::make($this->browserColumns)->mapWithKeys(function($column) use ($item) {
1293 1293
                 return $this->getItemColumnData($item, $column);
1294 1294
             })->toArray();
1295 1295
 
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
                     $fieldSplitted = explode('|', $field);
1356 1356
                     if (count($fieldSplitted) > 1) {
1357 1357
                         $requestValue = $requestFilters[$key];
1358
-                        Collection::make($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) {
1358
+                        Collection::make($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) {
1359 1359
                             $scope[$scopeKey] = $requestValue;
1360 1360
                         });
1361 1361
                     } else {
@@ -1531,11 +1531,11 @@  discard block
 block discarded – undo
1531 1531
      */
1532 1532
     protected function validateFormRequest()
1533 1533
     {
1534
-        $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function ($permission, $field) {
1534
+        $unauthorizedFields = Collection::make($this->fieldsPermissions)->filter(function($permission, $field) {
1535 1535
             return Auth::guard('twill_users')->user()->cannot($permission);
1536 1536
         })->keys();
1537 1537
 
1538
-        $unauthorizedFields->each(function ($field) {
1538
+        $unauthorizedFields->each(function($field) {
1539 1539
             $this->request->offsetUnset($field);
1540 1540
         });
1541 1541
 
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
      */
1779 1779
     public function getRepeaterList()
1780 1780
     {
1781
-        return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function ($repeater) {
1781
+        return app(BlockCollection::class)->getRepeaterList()->mapWithKeys(function($repeater) {
1782 1782
             return [$repeater['name'] => $repeater];
1783 1783
         });
1784 1784
     }
Please login to merge, or discard this patch.
src/Services/Assets/Twill.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
     private function readManifest()
70 70
     {
71 71
         try {
72
-            return Cache::rememberForever('twill-manifest', function () {
72
+            return Cache::rememberForever('twill-manifest', function() {
73 73
                 return $this->readJson($this->getManifestFilename());
74 74
             });
75 75
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/Services/Routing/HasRoutes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $routesFile
18 18
     ) {
19 19
         if (file_exists($routesFile)) {
20
-            $hostRoutes = function ($router) use (
20
+            $hostRoutes = function($router) use (
21 21
                 $middlewares,
22 22
                 $namespace,
23 23
                 $routesFile
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
                         'namespace' => $namespace,
28 28
                         'middleware' => $middlewares,
29 29
                     ],
30
-                    function ($router) use ($routesFile) {
30
+                    function($router) use ($routesFile) {
31 31
                         require $routesFile;
32 32
                     }
33 33
                 );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $manager = (new Manager());
127 127
 
128 128
         $manager->getCapsuleList()
129
-                ->each(function ($capsule) use ($router, $manager) {
129
+                ->each(function($capsule) use ($router, $manager) {
130 130
                     $this->registerCapsuleRoutes($router, $capsule, $manager);
131 131
                 });
132 132
     }
Please login to merge, or discard this patch.
src/Services/Blocks/Block.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -235,14 +235,14 @@
 block discarded – undo
235 235
             return $value;
236 236
         }
237 237
 
238
-        if ($configBlock = collect(config("twill.block_editor.blocks"))->filter(function ($block) use ($blockName) {
238
+        if ($configBlock = collect(config("twill.block_editor.blocks"))->filter(function($block) use ($blockName) {
239 239
             return Str::contains($block['component'], $blockName);
240 240
         })->first()) {
241 241
             if ($value = ($configBlock[$property] ?? null)) {
242 242
                 return $value;
243 243
             }
244 244
         }
245
-        if ($configRepeater = collect(config("twill.block_editor.repeaters"))->filter(function ($repeater) use ($blockName) {
245
+        if ($configRepeater = collect(config("twill.block_editor.repeaters"))->filter(function($repeater) use ($blockName) {
246 246
             return Str::contains($repeater['component'], $blockName);
247 247
         })->first()) {
248 248
             if ($value = ($configRepeater[$property] ?? null)) {
Please login to merge, or discard this patch.
src/Services/Blocks/BlockCollection.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
     public function findByName($search, $sources = [])
53 53
     {
54 54
         return $this->collect()
55
-            ->filter(function ($block) use ($search, $sources) {
55
+            ->filter(function($block) use ($search, $sources) {
56 56
                 return $block->name == $search &&
57 57
                     (blank($sources) ||
58 58
                     collect($sources)->contains($block->source));
59 59
             })
60
-            ->sortBy(function ($block) {
60
+            ->sortBy(function($block) {
61 61
                 return $block->source === 'app' ? 0 : 1;
62 62
             })
63 63
             ->first();
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     public function getBlocks()
70 70
     {
71 71
         return $this->collect()
72
-            ->filter(function ($block) {
72
+            ->filter(function($block) {
73 73
                 return $block->type === Block::TYPE_BLOCK;
74 74
             })
75 75
             ->values();
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getBlockList()
82 82
     {
83
-        return $this->getBlocks()->map(function (Block $block) {
83
+        return $this->getBlocks()->map(function(Block $block) {
84 84
             return $block->toList();
85 85
         });
86 86
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         return collect($this->fileSystem->files($directory))
111
-            ->map(function ($file) use ($source, $type) {
111
+            ->map(function($file) use ($source, $type) {
112 112
                 return new Block($file, $type, $source);
113 113
             });
114 114
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $this->paths = collect(
122 122
             config('twill.block_editor.directories.source.blocks')
123 123
         )
124
-            ->map(function ($path) {
124
+            ->map(function($path) {
125 125
                 $path['type'] = Block::TYPE_BLOCK;
126 126
 
127 127
                 return $path;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             ->merge(
130 130
                 collect(
131 131
                     config('twill.block_editor.directories.source.repeaters')
132
-                )->map(function ($path) {
132
+                )->map(function($path) {
133 133
                     $path['type'] = Block::TYPE_REPEATER;
134 134
 
135 135
                     return $path;
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
         $this->generatePaths();
168 168
 
169 169
         $this->items = collect($this->paths)
170
-            ->reduce(function (Collection $keep, $path) {
170
+            ->reduce(function(Collection $keep, $path) {
171 171
                 $this->readBlocks(
172 172
                     $path['path'],
173 173
                     $path['source'],
174 174
                     $path['type']
175
-                )->each(function ($block) use ($keep) {
175
+                )->each(function($block) use ($keep) {
176 176
                     $keep->push($block);
177 177
 
178 178
                     return $keep;
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
             ->toArray();
184 184
 
185 185
         $this->items = $this->collect()
186
-            ->each(function (Block $block) {
186
+            ->each(function(Block $block) {
187 187
                 $block->setSource($this->detectCustomSources($block));
188 188
             })
189 189
             ->toArray();
190 190
 
191 191
         // remove duplicate Twill blocks
192 192
         $appBlocks = $this->collect()->whereIn('source', [Block::SOURCE_APP, Block::SOURCE_CUSTOM]);
193
-        $this->items = $this->collect()->filter(function ($item) use ($appBlocks) {
194
-            return !$appBlocks->contains(function ($block) use ($item) {
193
+        $this->items = $this->collect()->filter(function($item) use ($appBlocks) {
194
+            return !$appBlocks->contains(function($block) use ($item) {
195 195
                 return $item->source === Block::SOURCE_TWILL && $item->name === $block->name;
196 196
             });
197 197
         })->values()->toArray();
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public function addBlocksFromConfig(Collection $items, $type)
216 216
     {
217
-        $items->reject(function ($value, $blockName) use ($type) {
218
-            return $this->contains(function ($block) use ($blockName, $type) {
217
+        $items->reject(function($value, $blockName) use ($type) {
218
+            return $this->contains(function($block) use ($blockName, $type) {
219 219
                 return $block->name === $blockName && $block->type === $type;
220 220
             }) ? [$blockName, $value] : false;
221 221
         })
222
-            ->each(function ($block, $blockName) use ($type) {
222
+            ->each(function($block, $blockName) use ($type) {
223 223
                 if ($block['compiled'] ?? false) {
224 224
                     $file = null;
225 225
                 } else {
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function logDeprecatedBlockConfig($blockName, $type)
262 262
     {
263
-        $path = $this->paths->filter(function ($path) use ($type) {
263
+        $path = $this->paths->filter(function($path) use ($type) {
264 264
             return $path['source'] === Block::SOURCE_APP && $path['type'] === $type;
265 265
         })->pluck('path')->join(', ', ' or ');
266 266
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     public function findFileByComponentName($componentName)
283 283
     {
284 284
         $filename = str_replace('a17-block-', '', $componentName) . '.blade.php';
285
-        $paths = $this->paths->pluck('path')->filter(function ($path) {
285
+        $paths = $this->paths->pluck('path')->filter(function($path) {
286 286
             return $this->fileSystem->exists($path);
287 287
         })->toArray();
288 288
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function list()
310 310
     {
311
-        return $this->collect()->map(function (Block $block) {
311
+        return $this->collect()->map(function(Block $block) {
312 312
             return $block->toList();
313 313
         });
314 314
     }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
     public function getRepeaters()
328 328
     {
329 329
         return $this->collect()
330
-            ->filter(function ($block) {
330
+            ->filter(function($block) {
331 331
                 return $block->type === Block::TYPE_REPEATER;
332 332
             })
333 333
             ->values();
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function getRepeaterList()
340 340
     {
341
-        return $this->getRepeaters()->map(function (Block $block) {
341
+        return $this->getRepeaters()->map(function(Block $block) {
342 342
             return $block->toList();
343 343
         });
344 344
     }
Please login to merge, or discard this patch.
src/RouteServiceProvider.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
         $middlewares,
83 83
         $supportSubdomainRouting
84 84
     ) {
85
-        $internalRoutes = function ($router) use (
85
+        $internalRoutes = function($router) use (
86 86
             $middlewares,
87 87
             $supportSubdomainRouting
88 88
         ) {
89
-            $router->group(['middleware' => $middlewares], function ($router) {
89
+            $router->group(['middleware' => $middlewares], function($router) {
90 90
                 require __DIR__ . '/../routes/admin.php';
91 91
             });
92 92
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                     ? ['supportSubdomainRouting']
97 97
                     : [],
98 98
                 ],
99
-                function ($router) {
99
+                function($router) {
100 100
                     require __DIR__ . '/../routes/auth.php';
101 101
                 }
102 102
             );
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     ? ['twill_auth:twill_users']
108 108
                     : [],
109 109
                 ],
110
-                function ($router) {
110
+                function($router) {
111 111
                     require __DIR__ . '/../routes/templates.php';
112 112
                 }
113 113
             );
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $groupOptions + [
118 118
                 'namespace' => $this->namespace . '\Admin',
119 119
             ],
120
-            function ($router) use ($internalRoutes, $supportSubdomainRouting) {
120
+            function($router) use ($internalRoutes, $supportSubdomainRouting) {
121 121
                 $router->group(
122 122
                     [
123 123
                         'domain' => config('twill.admin_app_url'),
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                         config('twill.admin_middleware_group', 'web'),
149 149
                     ],
150 150
                 ],
151
-                function ($router) {
151
+                function($router) {
152 152
                     $router->group(
153 153
                         [
154 154
                             'middleware' => $this->app->environment(
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                             ? ['twill_auth:twill_users']
158 158
                             : [],
159 159
                         ],
160
-                        function ($router) {
160
+                        function($router) {
161 161
                             require __DIR__ . '/../routes/templates.php';
162 162
                         }
163 163
                     );
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     protected function registerMacros()
212 212
     {
213
-        Route::macro('moduleShowWithPreview', function (
213
+        Route::macro('moduleShowWithPreview', function(
214 214
             $moduleName,
215 215
             $routePrefix = null,
216 216
             $controllerName = null
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                 ->middleware(['web', 'twill_auth:twill_users', 'can:list']);
245 245
         });
246 246
 
247
-        Route::macro('module', function (
247
+        Route::macro('module', function(
248 248
             $slug,
249 249
             $options = [],
250 250
             $resource_options = [],
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             $_slug = Arr::last($slugs);
256 256
             $className = implode(
257 257
                 '',
258
-                array_map(function ($s) {
258
+                array_map(function($s) {
259 259
                     return ucfirst(Str::singular($s));
260 260
                 }, $slugs)
261 261
             );
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             if ($resource) {
381 381
                 Route::group(
382 382
                     ['as' => $resourceCustomGroupPrefix],
383
-                    function () use ($slug, $className, $resource_options) {
383
+                    function() use ($slug, $className, $resource_options) {
384 384
                         Route::resource(
385 385
                             $slug,
386 386
                             "{$className}Controller",
Please login to merge, or discard this patch.