Completed
Push — 1.1 ( 4d5846...b85b4d )
by Quentin
12s
created
src/Models/Model.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
     public function scopeVisible($query)
33 33
     {
34 34
         if ($this->isFillable('publish_start_date')) {
35
-            $query->where(function ($query) {
35
+            $query->where(function($query) {
36 36
                 $query->whereNull('publish_start_date')->orWhere('publish_start_date', '<=', Carbon::now());
37 37
             });
38 38
 
39 39
             if ($this->isFillable('publish_end_date')) {
40
-                $query->where(function ($query) {
40
+                $query->where(function($query) {
41 41
                     $query->whereNull('publish_end_date')->orWhere('publish_end_date', '>=', Carbon::now());
42 42
                 });
43 43
             }
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/DashboardController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 
79 79
     private function getAllActivities()
80 80
     {
81
-        return Activity::take(20)->latest()->get()->map(function ($activity) {
81
+        return Activity::take(20)->latest()->get()->map(function($activity) {
82 82
             return $this->formatActivity($activity);
83 83
         })->filter()->values();
84 84
     }
85 85
 
86 86
     private function getLoggedInUserActivities()
87 87
     {
88
-        return Activity::where('causer_id', auth()->user()->id)->take(20)->latest()->get()->map(function ($activity) {
88
+        return Activity::where('causer_id', auth()->user()->id)->take(20)->latest()->get()->map(function($activity) {
89 89
             return $this->formatActivity($activity);
90 90
         })->filter()->values();
91 91
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             return [];
128 128
         }
129 129
 
130
-        $statsByDate = collect($response['rows'] ?? [])->map(function (array $dateRow) {
130
+        $statsByDate = collect($response['rows'] ?? [])->map(function(array $dateRow) {
131 131
             return [
132 132
                 'date' => $dateRow[0],
133 133
                 'users' => (int) $dateRow[1],
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             'yesterday',
143 143
             'week',
144 144
             'month',
145
-        ])->mapWithKeys(function ($period) use ($statsByDate) {
145
+        ])->mapWithKeys(function($period) use ($statsByDate) {
146 146
             $stats = $this->getPeriodStats($period, $statsByDate);
147 147
             return [
148 148
                 $period => [
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
                 'stats' => $stats = $statsByDate->first(),
175 175
                 'moreUsers' => $stats['users'] > $statsByDate->get(1)['users'],
176 176
                 'morePageViews' => $stats['pageViews'] > $statsByDate->get(1)['pageViews'],
177
-                'usersData' => $statsByDate->take(7)->map(function ($stat) {
177
+                'usersData' => $statsByDate->take(7)->map(function($stat) {
178 178
                     return $stat['users'];
179 179
                 }),
180
-                'pageViewsData' => $statsByDate->take(7)->map(function ($stat) {
180
+                'pageViewsData' => $statsByDate->take(7)->map(function($stat) {
181 181
                     return $stat['pageViews'];
182 182
                 }),
183 183
             ];
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
                 'stats' => $stats = $statsByDate->get(1),
187 187
                 'moreUsers' => $stats['users'] > $statsByDate->get(2)['users'],
188 188
                 'morePageViews' => $stats['pageViews'] > $statsByDate->get(2)['pageViews'],
189
-                'usersData' => $statsByDate->slice(1)->take(7)->map(function ($stat) {
189
+                'usersData' => $statsByDate->slice(1)->take(7)->map(function($stat) {
190 190
                     return $stat['users'];
191 191
                 }),
192
-                'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function ($stat) {
192
+                'pageViewsData' => $statsByDate->slice(1)->take(7)->map(function($stat) {
193 193
                     return $stat['pageViews'];
194 194
                 }),
195 195
             ];
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
                 'stats' => $stats,
213 213
                 'moreUsers' => $stats['users'] > $compareStats['users'],
214 214
                 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'],
215
-                'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) {
215
+                'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) {
216 216
                     return $stat['users'];
217 217
                 }),
218
-                'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) {
218
+                'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) {
219 219
                     return $stat['pageViews'];
220 220
                 }),
221 221
             ];
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
                 'stats' => $stats,
239 239
                 'moreUsers' => $stats['users'] > $compareStats['users'],
240 240
                 'morePageViews' => $stats['pageViews'] > $compareStats['pageViews'],
241
-                'usersData' => $statsByDate->slice(1)->take(29)->map(function ($stat) {
241
+                'usersData' => $statsByDate->slice(1)->take(29)->map(function($stat) {
242 242
                     return $stat['users'];
243 243
                 }),
244
-                'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function ($stat) {
244
+                'pageViewsData' => $statsByDate->slice(1)->take(29)->map(function($stat) {
245 245
                     return $stat['pageViews'];
246 246
                 }),
247 247
             ];
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
 
260 260
     private function getShortcuts($modules)
261 261
     {
262
-        return $modules->filter(function ($module) {
262
+        return $modules->filter(function($module) {
263 263
             return ($module['count'] ?? false) || ($module['create'] ?? false);
264
-        })->map(function ($module) {
264
+        })->map(function($module) {
265 265
             $repository = $this->getRepository($module['name']);
266 266
 
267 267
             $moduleOptions = [
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/MediaLibraryController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $items = $this->getIndexItems($scopes);
52 52
 
53 53
         return [
54
-            'items' => $items->map(function ($item) {
54
+            'items' => $items->map(function($item) {
55 55
                 return $this->buildMedia($item);
56 56
             })->toArray(),
57 57
             'maxPage' => $items->lastPage(),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     private function buildMedia($item)
64 64
     {
65 65
         return $item->toCmsArray() + [
66
-            'tags' => $item->tags->map(function ($tag) {
66
+            'tags' => $item->tags->map(function($tag) {
67 67
                 return $tag->name;
68 68
             }),
69 69
             'deleteUrl' => $item->canDeleteSafely() ? moduleRoute($this->moduleName, $this->routePrefix, 'destroy', $item->id) : null,
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         $items = $this->getIndexItems($scopes);
173 173
 
174 174
         return response()->json([
175
-            'items' => $items->map(function ($item) {
175
+            'items' => $items->map(function($item) {
176 176
                 return $this->buildMedia($item);
177 177
             })->toArray(),
178 178
             'tags' => $this->repository->getTagsList(),
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/BlocksController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 
36 36
         $blocksCollection->push($newBlock);
37 37
 
38
-        $block['blocks']->each(function ($childBlock) use ($newBlock, $blocksCollection, $blockRepository) {
38
+        $block['blocks']->each(function($childBlock) use ($newBlock, $blocksCollection, $blockRepository) {
39 39
             $childBlock['parent_id'] = $newBlock->id;
40 40
             $newChildBlock = $blockRepository->createForPreview($childBlock);
41 41
             $blocksCollection->push($newChildBlock);
42 42
         });
43 43
 
44
-        $renderedBlocks = $blocksCollection->where('parent_id', null)->map(function ($block) use ($blocksCollection) {
44
+        $renderedBlocks = $blocksCollection->where('parent_id', null)->map(function($block) use ($blocksCollection) {
45 45
             if (config('twill.block_editor.block_preview_render_childs') ?? true) {
46 46
                 $childBlocks = $blocksCollection->where('parent_id', $block->id);
47
-                $renderedChildViews = $childBlocks->map(function ($childBlock) {
47
+                $renderedChildViews = $childBlocks->map(function($childBlock) {
48 48
                     $view = $this->getBlockView($childBlock->type);
49 49
                     return view($view)->with('block', $childBlock)->render();
50 50
                 })->implode('');
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/FeaturedController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
         $featuredSources = $this->getFeaturedSources($featuredSection, $filters['search'] ?? '');
20 20
 
21
-        $contentTypes = collect($featuredSources)->map(function ($source, $sourceKey) {
21
+        $contentTypes = collect($featuredSources)->map(function($source, $sourceKey) {
22 22
             return [
23 23
                 'label' => $source['name'],
24 24
                 'value' => $sourceKey,
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
         })->values()->toArray();
27 27
 
28 28
         if (request()->has('content_type')) {
29
-            $source = array_first($featuredSources, function ($source, $sourceKey) {
29
+            $source = array_first($featuredSources, function($source, $sourceKey) {
30 30
                 return $sourceKey == request('content_type');
31 31
             });
32 32
 
33 33
             return [
34 34
                 'source' => [
35
-                    'content_type' => array_first($contentTypes, function ($contentTypeItem) {
35
+                    'content_type' => array_first($contentTypes, function($contentTypeItem) {
36 36
                         return $contentTypeItem['value'] == request('content_type');
37 37
                     }),
38 38
                     'items' => $source['items'],
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     private function getFeaturedItemsByBucket($featuredSection, $featuredSectionKey)
73 73
     {
74 74
         $bucketRouteConfig = config('twill.bucketsRoutes') ?? [$featuredSectionKey => 'featured'];
75
-        return collect($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) {
75
+        return collect($featuredSection['buckets'])->map(function($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) {
76 76
             $routePrefix = $bucketRouteConfig[$featuredSectionKey];
77 77
             return [
78 78
                 'id' => $bucketKey,
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 'acceptedSources' => collect($bucket['bucketables'])->pluck('module'),
82 82
                 'withToggleFeatured' => $bucket['with_starred_items'] ?? false,
83 83
                 'toggleFeaturedLabels' => $bucket['starred_items_labels'] ?? [],
84
-                'children' => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function ($feature) {
84
+                'children' => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function($feature) {
85 85
                     if (($item = $feature->featured) != null) {
86 86
                         $repository = $this->getRepository($feature->featured_type);
87 87
                         $withImage = classHasTrait($repository, HandleMedias::class);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                             'thumbnail' => $item->defaultCmsImage(['w' => 100, 'h' => 100]),
100 100
                         ] : []);
101 101
                     }
102
-                })->reject(function ($item) {
102
+                })->reject(function($item) {
103 103
                     return is_null($item);
104 104
                 })->values()->toArray(),
105 105
             ];
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         $fetchedModules = [];
112 112
         $featuredSources = [];
113 113
 
114
-        collect($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use (&$fetchedModules, $search) {
115
-            return collect($bucket['bucketables'])->mapWithKeys(function ($bucketable) use (&$fetchedModules, $bucketKey, $search) {
114
+        collect($featuredSection['buckets'])->map(function($bucket, $bucketKey) use (&$fetchedModules, $search) {
115
+            return collect($bucket['bucketables'])->mapWithKeys(function($bucketable) use (&$fetchedModules, $bucketKey, $search) {
116 116
 
117 117
                 $module = $bucketable['module'];
118 118
                 $repository = $this->getRepository($module);
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
                     'withImage' => $withImage,
142 142
                 ]];
143 143
             });
144
-        })->each(function ($bucketables, $bucket) use (&$featuredSources) {
145
-            $bucketables->each(function ($bucketableData, $bucketable) use ($bucket, &$featuredSources) {
144
+        })->each(function($bucketables, $bucket) use (&$featuredSources) {
145
+            $bucketables->each(function($bucketableData, $bucketable) use ($bucket, &$featuredSources) {
146 146
                 $featuredSources[$bucketable]['name'] = $bucketableData['name'];
147 147
                 $featuredSources[$bucketable]['maxPage'] = $bucketableData['items']->lastPage();
148 148
                 $featuredSources[$bucketable]['offset'] = $bucketableData['items']->perPage();
149
-                $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function ($item) use ($bucketableData, $bucketable) {
149
+                $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function($item) use ($bucketableData, $bucketable) {
150 150
                     return [
151 151
                         'id' => $item->id,
152 152
                         'name' => $item->titleInBucket ?? $item->title,
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 
171 171
     public function save()
172 172
     {
173
-        DB::transaction(function () {
174
-            collect(request('buckets'))->each(function ($bucketables, $bucketKey) {
173
+        DB::transaction(function() {
174
+            collect(request('buckets'))->each(function($bucketables, $bucketKey) {
175 175
                 Feature::where('bucket_key', $bucketKey)->delete();
176 176
                 foreach (($bucketables ?? []) as $position => $bucketable) {
177 177
                     Feature::create([
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/FileLibraryController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $items = $this->getIndexItems($scopes);
52 52
 
53 53
         return [
54
-            'items' => $items->map(function ($item) {
54
+            'items' => $items->map(function($item) {
55 55
                 return $this->buildFile($item);
56 56
             })->toArray(),
57 57
             'maxPage' => $items->lastPage(),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     private function buildFile($item)
64 64
     {
65 65
         return $item->toCmsArray() + [
66
-            'tags' => $item->tags->map(function ($tag) {
66
+            'tags' => $item->tags->map(function($tag) {
67 67
                 return $tag->name;
68 68
             }),
69 69
             'deleteUrl' => $item->canDeleteSafely() ? moduleRoute($this->moduleName, $this->routePrefix, 'destroy', $item->id) : null,
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $items = $this->getIndexItems($scopes);
153 153
 
154 154
         return response()->json([
155
-            'items' => $items->map(function ($item) {
155
+            'items' => $items->map(function($item) {
156 156
                 return $this->buildFile($item);
157 157
             })->toArray(),
158 158
             'tags' => $this->repository->getTagsList(),
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/ModuleController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             "$this->viewPrefix.index",
189 189
             "twill::$this->moduleName.index",
190 190
             "twill::layouts.listing",
191
-        ])->first(function ($view) {
191
+        ])->first(function($view) {
192 192
             return view()->exists($view);
193 193
         });
194 194
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
             "$this->viewPrefix.form",
252 252
             "twill::$this->moduleName.form",
253 253
             "twill::layouts.form",
254
-        ])->first(function ($view) {
254
+        ])->first(function($view) {
255 255
             return view()->exists($view);
256 256
         });
257 257
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
         $query = $this->request->input('q');
472 472
         $tags = $this->repository->getTags($query);
473 473
 
474
-        return response()->json(['items' => $tags->map(function ($tag) {
474
+        return response()->json(['items' => $tags->map(function($tag) {
475 475
             return $tag->name;
476 476
         })], 200);
477 477
     }
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
     protected function getIndexTableData($items)
535 535
     {
536 536
         $translated = $this->moduleHas('translations');
537
-        return $items->map(function ($item) use ($translated) {
538
-            $columnsData = collect($this->indexColumns)->mapWithKeys(function ($column) use ($item) {
537
+        return $items->map(function($item) use ($translated) {
538
+            $columnsData = collect($this->indexColumns)->mapWithKeys(function($column) use ($item) {
539 539
                 return $this->getItemColumnData($item, $column);
540 540
             })->toArray();
541 541
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             'feature',
766 766
             'bulkFeature',
767 767
             'bulkDelete',
768
-        ])->mapWithKeys(function ($endpoint) use ($moduleName, $routePrefix) {
768
+        ])->mapWithKeys(function($endpoint) use ($moduleName, $routePrefix) {
769 769
             return [
770 770
                 $endpoint . 'Url' => $this->getIndexOption($endpoint) ? moduleRoute(
771 771
                     $this->moduleName, $this->routePrefix, $endpoint,
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 
778 778
     protected function getIndexOption($option)
779 779
     {
780
-        return once(function () use ($option) {
780
+        return once(function() use ($option) {
781 781
             $customOptionNamesMapping = [
782 782
                 'store' => 'create',
783 783
             ];
@@ -822,8 +822,8 @@  discard block
 block discarded – undo
822 822
     {
823 823
         $withImage = $this->moduleHas('medias');
824 824
 
825
-        return $items->map(function ($item) {
826
-            $columnsData = collect($this->browserColumns)->mapWithKeys(function ($column) use ($item) {
825
+        return $items->map(function($item) {
826
+            $columnsData = collect($this->browserColumns)->mapWithKeys(function($column) use ($item) {
827 827
                 return $this->getItemColumnData($item, $column);
828 828
             })->toArray();
829 829
 
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
                     $fieldSplitted = explode('|', $field);
879 879
                     if (count($fieldSplitted) > 1) {
880 880
                         $requestValue = $requestFilters[$key];
881
-                        collect($fieldSplitted)->each(function ($scopeKey) use (&$scope, $requestValue) {
881
+                        collect($fieldSplitted)->each(function($scopeKey) use (&$scope, $requestValue) {
882 882
                             $scope[$scopeKey] = $requestValue;
883 883
                         });
884 884
                     } else {
Please login to merge, or discard this patch.
src/Http/Requests/Admin/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
     public function rules()
15 15
     {
16 16
         switch ($this->method()) {
17
-            case 'POST':{return $this->rulesForCreate();}
18
-            case 'PUT':{return $this->rulesForUpdate();}
17
+            case 'POST':{return $this->rulesForCreate(); }
18
+            case 'PUT':{return $this->rulesForUpdate(); }
19 19
             default:break;
20 20
         }
21 21
 
Please login to merge, or discard this patch.
src/TwillServiceProvider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
         }
94 94
 
95 95
         if (config('twill.enabled.media-library')) {
96
-            $this->app->singleton('imageService', function () {
96
+            $this->app->singleton('imageService', function() {
97 97
                 return $this->app->make(config('twill.media_library.image_service'));
98 98
             });
99 99
         }
100 100
 
101 101
         if (config('twill.enabled.file-library')) {
102
-            $this->app->singleton('fileService', function () {
102
+            $this->app->singleton('fileService', function() {
103 103
                 return $this->app->make(config('twill.file_library.file_service'));
104 104
             });
105 105
         }
@@ -248,20 +248,20 @@  discard block
 block discarded – undo
248 248
     {
249 249
         $blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler();
250 250
 
251
-        $blade->directive('dd', function ($param) {
251
+        $blade->directive('dd', function($param) {
252 252
             return "<?php dd({$param}); ?>";
253 253
         });
254 254
 
255
-        $blade->directive('dumpData', function ($data) {
255
+        $blade->directive('dumpData', function($data) {
256 256
             return sprintf("<?php (new Illuminate\Support\Debug\Dumper)->dump(%s); exit; ?>",
257 257
                 null != $data ? $data : "get_defined_vars()");
258 258
         });
259 259
 
260
-        $blade->directive('formField', function ($expression) use ($blade) {
260
+        $blade->directive('formField', function($expression) use ($blade) {
261 261
             return $this->includeView('partials.form._', $expression);
262 262
         });
263 263
 
264
-        $blade->directive('partialView', function ($expression) use ($blade) {
264
+        $blade->directive('partialView', function($expression) use ($blade) {
265 265
 
266 266
             $expressionAsArray = str_getcsv($expression, ',', '\'');
267 267
 
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
             ?>";
298 298
         });
299 299
 
300
-        $blade->directive('pushonce', function ($expression) {
300
+        $blade->directive('pushonce', function($expression) {
301 301
             list($pushName, $pushSub) = explode(':', trim(substr($expression, 1, -1)));
302 302
             $key = '__pushonce_' . $pushName . '_' . str_replace('-', '_', $pushSub);
303 303
             return "<?php if(! isset(\$__env->{$key})): \$__env->{$key} = 1; \$__env->startPush('{$pushName}'); ?>";
304 304
         });
305 305
 
306
-        $blade->directive('endpushonce', function () {
306
+        $blade->directive('endpushonce', function() {
307 307
             return '<?php $__env->stopPush(); endif; ?>';
308 308
         });
309 309
     }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 
325 325
         View::composer('twill::partials.navigation.*', ActiveNavigation::class);
326 326
 
327
-        View::composer(['admin.*', 'templates.*', 'twill::*'], function ($view) {
327
+        View::composer(['admin.*', 'templates.*', 'twill::*'], function($view) {
328 328
             $with = array_merge([
329 329
                 'renderForBlocks' => false,
330 330
                 'renderForModal' => false,
Please login to merge, or discard this patch.