Passed
Pull Request — 2.x (#704)
by Talv
08:50
created
src/Repositories/Behaviors/HandleBrowsers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function getFormFieldsForBrowser($object, $relation, $routePrefix = null, $titleKey = 'title', $moduleName = null)
109 109
     {
110
-        return $object->$relation->map(function ($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) {
110
+        return $object->$relation->map(function($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) {
111 111
             return [
112 112
                 'id' => $relatedElement->id,
113 113
                 'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey,
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function getFormFieldsForRelatedBrowser($object, $relation)
128 128
     {
129
-        return $object->getRelated($relation)->map(function ($relatedElement) {
129
+        return $object->getRelated($relation)->map(function($relatedElement) {
130 130
             return ($relatedElement != null) ? [
131 131
                 'id' => $relatedElement->id,
132 132
                 'name' => $relatedElement->titleInBrowser ?? $relatedElement->title,
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             ]) + (classHasTrait($relatedElement, HasMedias::class) ? [
137 137
                 'thumbnail' => $relatedElement->defaultCmsImage(['w' => 100, 'h' => 100]),
138 138
             ] : []) : [];
139
-        })->reject(function ($item) {
139
+        })->reject(function($item) {
140 140
             return empty($item);
141 141
         })->values()->toArray();
142 142
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     protected function getBrowsers()
151 151
     {
152
-        return collect($this->browsers)->map(function ($browser, $key) {
152
+        return collect($this->browsers)->map(function($browser, $key) {
153 153
             $browserName = is_string($browser) ? $browser : $key;
154 154
             $moduleName = !empty($browser['moduleName']) ? $browser['moduleName'] : $this->inferModuleNameFromBrowserName($browserName);
155 155
             
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleRevisions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@
 block discarded – undo
11 11
     public function hydrateHandleRevisions($object, $fields)
12 12
     {
13 13
         // HandleRepeaters trait => getRepeaters
14
-        foreach($this->getRepeaters() as $repeater) {
14
+        foreach ($this->getRepeaters() as $repeater) {
15 15
             $this->hydrateRepeater($object, $fields, $repeater['relation'], $repeater['model']);
16 16
         }
17 17
 
18 18
         // HandleBrowers trait => getBrowsers
19
-        foreach($this->getBrowsers() as $browser) {
19
+        foreach ($this->getBrowsers() as $browser) {
20 20
             $this->hydrateBrowser($object, $fields, $browser['relation'], $browser['positionAttribute'], $browser['model']);
21 21
         }
22 22
 
Please login to merge, or discard this patch.
src/AuthServiceProvider.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -31,78 +31,78 @@
 block discarded – undo
31 31
 
32 32
     public function boot()
33 33
     {
34
-        Gate::define('list', function ($user) {
35
-            return $this->authorize($user, function ($user) {
34
+        Gate::define('list', function($user) {
35
+            return $this->authorize($user, function($user) {
36 36
                 return $this->userHasRole($user, [UserRole::VIEWONLY, UserRole::PUBLISHER, UserRole::ADMIN]);
37 37
             });
38 38
         });
39 39
 
40
-        Gate::define('edit', function ($user) {
41
-            return $this->authorize($user, function ($user) {
40
+        Gate::define('edit', function($user) {
41
+            return $this->authorize($user, function($user) {
42 42
                 return $this->userHasRole($user, [UserRole::PUBLISHER, UserRole::ADMIN]);
43 43
             });
44 44
         });
45 45
 
46
-        Gate::define('reorder', function ($user) {
47
-            return $this->authorize($user, function ($user) {
46
+        Gate::define('reorder', function($user) {
47
+            return $this->authorize($user, function($user) {
48 48
                 return $this->userHasRole($user, [UserRole::PUBLISHER, UserRole::ADMIN]);
49 49
             });
50 50
         });
51 51
 
52
-        Gate::define('publish', function ($user) {
53
-            return $this->authorize($user, function ($user) {
52
+        Gate::define('publish', function($user) {
53
+            return $this->authorize($user, function($user) {
54 54
                 return $this->userHasRole($user, [UserRole::PUBLISHER, UserRole::ADMIN]);
55 55
             });
56 56
         });
57 57
 
58
-        Gate::define('feature', function ($user) {
59
-            return $this->authorize($user, function ($user) {
58
+        Gate::define('feature', function($user) {
59
+            return $this->authorize($user, function($user) {
60 60
                 return $this->userHasRole($user, [UserRole::PUBLISHER, UserRole::ADMIN]);
61 61
             });
62 62
         });
63 63
 
64
-        Gate::define('delete', function ($user) {
65
-            return $this->authorize($user, function ($user) {
64
+        Gate::define('delete', function($user) {
65
+            return $this->authorize($user, function($user) {
66 66
                 return $this->userHasRole($user, [UserRole::PUBLISHER, UserRole::ADMIN]);
67 67
             });
68 68
         });
69 69
 
70
-        Gate::define('duplicate', function ($user) {
71
-            return $this->authorize($user, function ($user) {
70
+        Gate::define('duplicate', function($user) {
71
+            return $this->authorize($user, function($user) {
72 72
                 return $this->userHasRole($user, [UserRole::PUBLISHER, UserRole::ADMIN]);
73 73
             });
74 74
         });
75 75
 
76
-        Gate::define('upload', function ($user) {
77
-            return $this->authorize($user, function ($user) {
76
+        Gate::define('upload', function($user) {
77
+            return $this->authorize($user, function($user) {
78 78
                 return $this->userHasRole($user, [UserRole::PUBLISHER, UserRole::ADMIN]);
79 79
             });
80 80
         });
81 81
 
82
-        Gate::define('manage-users', function ($user) {
83
-            return $this->authorize($user, function ($user) {
82
+        Gate::define('manage-users', function($user) {
83
+            return $this->authorize($user, function($user) {
84 84
                 return $this->userHasRole($user, [UserRole::ADMIN]);
85 85
             });
86 86
         });
87 87
 
88 88
         // As an admin, I can edit users, except superadmins
89 89
         // As a non-admin, I can edit myself only
90
-        Gate::define('edit-user', function ($user, $editedUser = null) {
91
-            return $this->authorize($user, function ($user) use ($editedUser) {
90
+        Gate::define('edit-user', function($user, $editedUser = null) {
91
+            return $this->authorize($user, function($user) use ($editedUser) {
92 92
                 $editedUserObject = User::find($editedUser);
93 93
                 return ($this->userHasRole($user, [UserRole::ADMIN]) || $user->id == $editedUser)
94 94
                     && ($editedUserObject ? $editedUserObject->role !== self::SUPERADMIN : true);
95 95
             });
96 96
         });
97 97
 
98
-        Gate::define('publish-user', function ($user) {
99
-            return $this->authorize($user, function ($user) {
98
+        Gate::define('publish-user', function($user) {
99
+            return $this->authorize($user, function($user) {
100 100
                 $editedUserObject = User::find(request('id'));
101 101
                 return $this->userHasRole($user, [UserRole::ADMIN]) && ($editedUserObject ? $user->id !== $editedUserObject->id && $editedUserObject->role !== self::SUPERADMIN : false);
102 102
             });
103 103
         });
104 104
 
105
-        Gate::define('impersonate', function ($user) {
105
+        Gate::define('impersonate', function($user) {
106 106
             return $user->role === self::SUPERADMIN;
107 107
         });
108 108
 
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleFieldsGroups.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             if ($object->$group) {
39 39
                 $decoded_fields = json_decode($object->$group, true) ?? [];
40 40
                 // In case that some field read the value through $item->$name
41
-                foreach($decoded_fields as $field_name => $field_value) {
41
+                foreach ($decoded_fields as $field_name => $field_value) {
42 42
                     $object->setAttribute($field_name, $field_value);
43 43
                 }
44 44
                 $fields = array_merge($fields, $decoded_fields);
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     protected function handleFieldsGroups($fields) {
52 52
         foreach ($this->fieldsGroups as $group => $groupFields) {
53
-            $fields[$group] = Arr::where(Arr::only($fields, $groupFields), function ($value, $key) {
53
+            $fields[$group] = Arr::where(Arr::only($fields, $groupFields), function($value, $key) {
54 54
                 return !empty($value);
55 55
             });
56 56
             
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/FeaturedController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         $featuredSources = $this->getFeaturedSources($request, $featuredSection, $filters['search'] ?? '');
44 44
 
45
-        $contentTypes = Collection::make($featuredSources)->map(function ($source, $sourceKey) {
45
+        $contentTypes = Collection::make($featuredSources)->map(function($source, $sourceKey) {
46 46
             return [
47 47
                 'label' => $source['name'],
48 48
                 'value' => $sourceKey,
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
             return [
56 56
                 'source' => [
57
-                    'content_type' => Arr::first($contentTypes, function ($contentTypeItem) use ($request) {
57
+                    'content_type' => Arr::first($contentTypes, function($contentTypeItem) use ($request) {
58 58
                         return $contentTypeItem['value'] == $request->get('content_type');
59 59
                     }),
60 60
                     'items' => $source['items'],
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     private function getFeaturedItemsByBucket($featuredSection, $featuredSectionKey)
101 101
     {
102 102
         $bucketRouteConfig = $this->config->get('twill.bucketsRoutes') ?? [$featuredSectionKey => 'featured'];
103
-        return Collection::make($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) {
103
+        return Collection::make($featuredSection['buckets'])->map(function($bucket, $bucketKey) use ($featuredSectionKey, $bucketRouteConfig) {
104 104
             $routePrefix = $bucketRouteConfig[$featuredSectionKey];
105 105
             return [
106 106
                 'id' => $bucketKey,
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                 'acceptedSources' => Collection::make($bucket['bucketables'])->pluck('module'),
110 110
                 'withToggleFeatured' => $bucket['with_starred_items'] ?? false,
111 111
                 'toggleFeaturedLabels' => $bucket['starred_items_labels'] ?? [],
112
-                'children' => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function ($feature) use ($bucket) {
112
+                'children' => Feature::where('bucket_key', $bucketKey)->with('featured')->get()->map(function($feature) use ($bucket) {
113 113
                     if (($item = $feature->featured) != null) {
114 114
                         $forModuleRepository = collect($bucket['bucketables'])->where('module', $feature->featured_type)->first()['repository'] ?? null;
115 115
                         $repository = $this->getRepository($feature->featured_type, $forModuleRepository);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                             'thumbnail' => $item->defaultCmsImage(['w' => 100, 'h' => 100]),
129 129
                         ] : []);
130 130
                     }
131
-                })->reject(function ($item) {
131
+                })->reject(function($item) {
132 132
                     return is_null($item);
133 133
                 })->values()->toArray(),
134 134
             ];
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
         $fetchedModules = [];
147 147
         $featuredSources = [];
148 148
 
149
-        Collection::make($featuredSection['buckets'])->map(function ($bucket, $bucketKey) use (&$fetchedModules, $search, $request) {
150
-            return Collection::make($bucket['bucketables'])->mapWithKeys(function ($bucketable) use (&$fetchedModules, $search, $request) {
149
+        Collection::make($featuredSection['buckets'])->map(function($bucket, $bucketKey) use (&$fetchedModules, $search, $request) {
150
+            return Collection::make($bucket['bucketables'])->mapWithKeys(function($bucketable) use (&$fetchedModules, $search, $request) {
151 151
 
152 152
                 $module = $bucketable['module'];
153 153
                 $repository = $this->getRepository($module, $bucketable['repository'] ?? null);
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
                     'withImage' => $withImage,
177 177
                 ]];
178 178
             });
179
-        })->each(function ($bucketables, $bucket) use (&$featuredSources) {
180
-            $bucketables->each(function ($bucketableData, $bucketable) use (&$featuredSources) {
179
+        })->each(function($bucketables, $bucket) use (&$featuredSources) {
180
+            $bucketables->each(function($bucketableData, $bucketable) use (&$featuredSources) {
181 181
                 $featuredSources[$bucketable]['name'] = $bucketableData['name'];
182 182
                 $featuredSources[$bucketable]['maxPage'] = $bucketableData['items']->lastPage();
183 183
                 $featuredSources[$bucketable]['offset'] = $bucketableData['items']->perPage();
184
-                $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function ($item) use ($bucketableData, $bucketable) {
184
+                $featuredSources[$bucketable]['items'] = $bucketableData['items']->map(function($item) use ($bucketableData, $bucketable) {
185 185
                     return [
186 186
                         'id' => $item->id,
187 187
                         'name' => $item->titleInBucket ?? $item->title,
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function save(Request $request, DB $db)
212 212
     {
213
-        $db->transaction(function () use ($request) {
214
-            Collection::make($request->get('buckets'))->each(function ($bucketables, $bucketKey) {
213
+        $db->transaction(function() use ($request) {
214
+            Collection::make($request->get('buckets'))->each(function($bucketables, $bucketKey) {
215 215
                 Feature::where('bucket_key', $bucketKey)->delete();
216 216
                 foreach (($bucketables ?? []) as $position => $bucketable) {
217 217
                     Feature::create([
Please login to merge, or discard this patch.
src/ValidationServiceProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
      */
17 17
     public function boot()
18 18
     {
19
-        Validator::extend('absolute_or_relative_url', function ($attribute, $value, $parameters, $validator) {
19
+        Validator::extend('absolute_or_relative_url', function($attribute, $value, $parameters, $validator) {
20 20
             return Str::startsWith($value, '/') || Validator::make([$attribute => $value], [$attribute => 'url'])->passes();
21 21
         }, 'The :attribute should be a valid url (absolute or relative)');
22 22
 
23
-        Validator::extend('relative_or_secure_url', function ($attribute, $value, $parameters) {
23
+        Validator::extend('relative_or_secure_url', function($attribute, $value, $parameters) {
24 24
             return Str::startsWith($value, '/') || filter_var($value, FILTER_VALIDATE_URL) !== false && Str::startsWith($value, 'https');
25 25
         }, 'The :attribute should be a valid url (relative or https)');
26 26
 
27
-        Validator::extend('web_color', function ($attribute, $value, $parameters, $validator) {
27
+        Validator::extend('web_color', function($attribute, $value, $parameters, $validator) {
28 28
             return preg_match('/^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i', $value);
29 29
         });
30 30
 
31
-        Validator::extend('phone_number', function ($attribute, $value, $parameters) {
31
+        Validator::extend('phone_number', function($attribute, $value, $parameters) {
32 32
             return preg_match("/^[+]?[0-9\-\ ]*$/", $value);
33 33
         });
34 34
 
35
-        Validator::extend('validBlocks', function ($attribute, $value, $parameters, $validator) {
35
+        Validator::extend('validBlocks', function($attribute, $value, $parameters, $validator) {
36 36
             $blockMessages = [];
37 37
 
38 38
             foreach ($value as $block) {
Please login to merge, or discard this patch.
src/Helpers/frontend_helpers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     {
12 12
         if (!app()->environment('local', 'development')) {
13 13
             try {
14
-                $manifest = Cache::rememberForever('rev-manifest', function () {
14
+                $manifest = Cache::rememberForever('rev-manifest', function() {
15 15
                     return json_decode(file_get_contents(config('twill.frontend.rev_manifest_path')), true);
16 16
                 });
17 17
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         }
54 54
 
55 55
         try {
56
-            $manifest = Cache::rememberForever('twill-manifest', function () {
56
+            $manifest = Cache::rememberForever('twill-manifest', function() {
57 57
                 return json_decode(file_get_contents(
58 58
                     public_path(config('twill.public_directory', 'twill'))
59 59
                     . '/'
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
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
         }
125 125
 
126 126
         if (config('twill.enabled.media-library')) {
127
-            $this->app->singleton('imageService', function () {
127
+            $this->app->singleton('imageService', function() {
128 128
                 return $this->app->make(config('twill.media_library.image_service'));
129 129
             });
130 130
         }
131 131
 
132 132
         if (config('twill.enabled.file-library')) {
133
-            $this->app->singleton('fileService', function () {
133
+            $this->app->singleton('fileService', function() {
134 134
                 return $this->app->make(config('twill.file_library.file_service'));
135 135
             });
136 136
         }
@@ -307,20 +307,20 @@  discard block
 block discarded – undo
307 307
     {
308 308
         $blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler();
309 309
 
310
-        $blade->directive('dd', function ($param) {
310
+        $blade->directive('dd', function($param) {
311 311
             return "<?php dd({$param}); ?>";
312 312
         });
313 313
 
314
-        $blade->directive('dumpData', function ($data) {
314
+        $blade->directive('dumpData', function($data) {
315 315
             return sprintf("<?php (new Symfony\Component\VarDumper\VarDumper)->dump(%s); exit; ?>",
316 316
                 null != $data ? $data : "get_defined_vars()");
317 317
         });
318 318
 
319
-        $blade->directive('formField', function ($expression) {
319
+        $blade->directive('formField', function($expression) {
320 320
             return $this->includeView('partials.form._', $expression);
321 321
         });
322 322
 
323
-        $blade->directive('partialView', function ($expression) {
323
+        $blade->directive('partialView', function($expression) {
324 324
 
325 325
             $expressionAsArray = str_getcsv($expression, ',', '\'');
326 326
 
@@ -356,13 +356,13 @@  discard block
 block discarded – undo
356 356
             ?>";
357 357
         });
358 358
 
359
-        $blade->directive('pushonce', function ($expression) {
359
+        $blade->directive('pushonce', function($expression) {
360 360
             list($pushName, $pushSub) = explode(':', trim(substr($expression, 1, -1)));
361 361
             $key = '__pushonce_' . $pushName . '_' . str_replace('-', '_', $pushSub);
362 362
             return "<?php if(! isset(\$__env->{$key})): \$__env->{$key} = 1; \$__env->startPush('{$pushName}'); ?>";
363 363
         });
364 364
 
365
-        $blade->directive('endpushonce', function () {
365
+        $blade->directive('endpushonce', function() {
366 366
             return '<?php $__env->stopPush(); endif; ?>';
367 367
         });
368 368
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
         View::composer('twill::partials.navigation.*', ActiveNavigation::class);
396 396
 
397
-        View::composer(['admin.*', 'templates.*', 'twill::*'], function ($view) {
397
+        View::composer(['admin.*', 'templates.*', 'twill::*'], function($view) {
398 398
             $with = array_merge([
399 399
                 'renderForBlocks' => false,
400 400
                 'renderForModal' => false,
Please login to merge, or discard this patch.
src/Http/Controllers/Admin/DashboardController.php 1 patch
Spacing   +20 added lines, -20 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
     }
@@ -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.