Passed
Pull Request — 1.1 (#17)
by Quentin
04:56
created
src/Models/Behaviors/HasMedias.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
     public function image($role, $crop = 'default', $params = [], $has_fallback = false, $cms = false, $media = null)
26 26
     {
27 27
         if (!$media) {
28
-            $media = $this->medias->first(function ($media) use ($role, $crop) {
28
+            $media = $this->medias->first(function($media) use ($role, $crop) {
29 29
                 return $media->pivot->role === $role && $media->pivot->crop === $crop;
30 30
             });
31 31
         }
32 32
 
33 33
         if ($media) {
34
-            $crop_params = ['rect' => $media->pivot->crop_x.','.$media->pivot->crop_y.','.$media->pivot->crop_w.','.$media->pivot->crop_h] + $params;
34
+            $crop_params = ['rect' => $media->pivot->crop_x . ',' . $media->pivot->crop_y . ',' . $media->pivot->crop_w . ',' . $media->pivot->crop_h] + $params;
35 35
 
36 36
             if ($cms) {
37 37
                 return ImageService::getCmsUrl($media->uuid, $crop_params);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function images($role, $crop = 'default', $params = [])
51 51
     {
52
-        $medias = $this->medias->filter(function ($media) use ($role, $crop) {
52
+        $medias = $this->medias->filter(function($media) use ($role, $crop) {
53 53
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
54 54
         });
55 55
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     public function imageAsArray($role, $crop = 'default', $params = [], $media = null)
66 66
     {
67 67
         if (!$media) {
68
-            $media = $this->medias->first(function ($media) use ($role, $crop) {
68
+            $media = $this->medias->first(function($media) use ($role, $crop) {
69 69
                 return $media->pivot->role === $role && $media->pivot->crop === $crop;
70 70
             });
71 71
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     public function imagesAsArrays($role, $crop = 'default', $params = [])
88 88
     {
89
-        $medias = $this->medias->filter(function ($media) use ($role, $crop) {
89
+        $medias = $this->medias->filter(function($media) use ($role, $crop) {
90 90
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
91 91
         });
92 92
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     public function imageAltText($role, $media = null)
103 103
     {
104 104
         if (!$media) {
105
-            $media = $this->medias->first(function ($media) use ($role) {
105
+            $media = $this->medias->first(function($media) use ($role) {
106 106
                 return $media->pivot->role === $role;
107 107
             });
108 108
         }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     public function imageCaption($role, $media = null)
118 118
     {
119 119
         if (!$media) {
120
-            $media = $this->medias->first(function ($media) use ($role) {
120
+            $media = $this->medias->first(function($media) use ($role) {
121 121
                 return $media->pivot->role === $role;
122 122
             });
123 123
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     public function imageVideo($role, $media = null)
133 133
     {
134 134
         if (!$media) {
135
-            $media = $this->medias->first(function ($media) use ($role) {
135
+            $media = $this->medias->first(function($media) use ($role) {
136 136
                 return $media->pivot->role === $role;
137 137
             });
138 138
         }
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function imageObject($role, $crop = 'default')
151 151
     {
152
-        return $this->medias->first(function ($media) use ($role, $crop) {
152
+        return $this->medias->first(function($media) use ($role, $crop) {
153 153
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
154 154
         });
155 155
     }
156 156
 
157 157
     public function lowQualityImagePlaceholder($role, $crop = 'default', $params = [], $has_fallback = false)
158 158
     {
159
-        $media = $this->medias->first(function ($media) use ($role, $crop) {
159
+        $media = $this->medias->first(function($media) use ($role, $crop) {
160 160
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
161 161
         });
162 162
 
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 
174 174
     public function socialImage($role, $crop = 'default', $params = [], $has_fallback = false)
175 175
     {
176
-        $media = $this->medias->first(function ($media) use ($role, $crop) {
176
+        $media = $this->medias->first(function($media) use ($role, $crop) {
177 177
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
178 178
         });
179 179
 
180 180
         if ($media) {
181
-            $crop_params = ['rect' => $media->pivot->crop_x.','.$media->pivot->crop_y.','.$media->pivot->crop_w.','.$media->pivot->crop_h] + $params;
181
+            $crop_params = ['rect' => $media->pivot->crop_x . ',' . $media->pivot->crop_y . ',' . $media->pivot->crop_w . ',' . $media->pivot->crop_h] + $params;
182 182
 
183 183
             return ImageService::getSocialUrl($media->uuid, $crop_params);
184 184
         }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
     public function imageObjects($role, $crop = 'default')
210 210
     {
211
-        return $this->medias->filter(function ($media) use ($role, $crop) {
211
+        return $this->medias->filter(function($media) use ($role, $crop) {
212 212
             return $media->pivot->role === $role && $media->pivot->crop === $crop;
213 213
         });
214 214
     }
Please login to merge, or discard this patch.
src/Models/Behaviors/HasSlug.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,39 +10,39 @@  discard block
 block discarded – undo
10 10
 
11 11
     protected static function bootHasSlug()
12 12
     {
13
-        static::created(function ($model) {
13
+        static::created(function($model) {
14 14
             $model->setSlugs();
15 15
         });
16 16
 
17
-        static::updated(function ($model) {
17
+        static::updated(function($model) {
18 18
             $model->setSlugs();
19 19
         });
20 20
 
21
-        static::restored(function ($model) {
21
+        static::restored(function($model) {
22 22
             $model->setSlugs($restoring = true);
23 23
         });
24 24
     }
25 25
 
26 26
     public function slugs()
27 27
     {
28
-        return $this->hasMany("App\Models\Slugs\\".$this->getSlugClassName());
28
+        return $this->hasMany("App\Models\Slugs\\" . $this->getSlugClassName());
29 29
     }
30 30
 
31 31
     public function getSlugClass()
32 32
     {
33
-        $slugClassName = "App\Models\Slugs\\".$this->getSlugClassName();
33
+        $slugClassName = "App\Models\Slugs\\" . $this->getSlugClassName();
34 34
 
35 35
         return new $slugClassName();
36 36
     }
37 37
 
38 38
     protected function getSlugClassName()
39 39
     {
40
-        return class_basename($this).'Slug';
40
+        return class_basename($this) . 'Slug';
41 41
     }
42 42
 
43 43
     public function scopeForSlug($query, $slug)
44 44
     {
45
-        return $query->whereHas('slugs', function ($query) use ($slug) {
45
+        return $query->whereHas('slugs', function($query) use ($slug) {
46 46
             $query->whereSlug($slug);
47 47
             $query->whereActive(true);
48 48
             $query->whereLocale(app()->getLocale());
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function scopeForInactiveSlug($query, $slug)
53 53
     {
54
-        return $query->whereHas('slugs', function ($query) use ($slug) {
54
+        return $query->whereHas('slugs', function($query) use ($slug) {
55 55
             $query->whereSlug($slug);
56 56
             $query->whereLocale(app()->getLocale());
57 57
         })->with(['slugs']);
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
         foreach ($slugParams as $key => $value) {
93 93
             //check variations of the slug
94 94
             if ($key == 'slug') {
95
-                $query->where(function ($query) use ($value) {
95
+                $query->where(function($query) use ($value) {
96 96
                     $query->orWhere('slug', $value);
97
-                    $query->orWhere('slug', $value.'-'.$this->getSuffixSlug());
97
+                    $query->orWhere('slug', $value . '-' . $this->getSuffixSlug());
98 98
                     for ($i = 2; $i <= $this->nb_variation_slug; $i++) {
99
-                        $query->orWhere('slug', $value.'-'.$i);
99
+                        $query->orWhere('slug', $value . '-' . $i);
100 100
                     }
101 101
                 });
102 102
             } else {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             }
152 152
 
153 153
             if (!empty($slugParams['slug'])) {
154
-                $slugParams['slug'] = $slugBackup.(($i > $this->nb_variation_slug) ? '-'.$this->getSuffixSlug() : "-{$i}");
154
+                $slugParams['slug'] = $slugBackup . (($i > $this->nb_variation_slug) ? '-' . $this->getSuffixSlug() : "-{$i}");
155 155
             }
156 156
         }
157 157
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
     public function getActiveSlug($locale = null)
162 162
     {
163
-        return $this->slugs->first(function ($slug) use ($locale) {
163
+        return $this->slugs->first(function($slug) use ($locale) {
164 164
             return ($slug->locale === ($locale ?? app()->getLocale())) && $slug->active;
165 165
         }) ?? null;
166 166
     }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
     public function getForeignKey()
271 271
     {
272
-        return snake_case(class_basename(get_class($this))).'_id';
272
+        return snake_case(class_basename(get_class($this))) . '_id';
273 273
     }
274 274
 
275 275
     protected function getSuffixSlug()
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $str = preg_replace('/[^\p{L}\p{Nd}]+/u', $options['delimiter'], $str);
373 373
 
374 374
         // Remove duplicate delimiters
375
-        $str = preg_replace('/('.preg_quote($options['delimiter'], '/').'){2,}/', '$1', $str);
375
+        $str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str);
376 376
 
377 377
         // Truncate slug to max. characters
378 378
         $str = mb_substr($str, 0, ($options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8')), 'UTF-8');
Please login to merge, or discard this patch.
src/Models/Behaviors/HasBlocks.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function renderBlocks($renderChilds = true, $blockViewMappings = [], $data = [])
15 15
     {
16
-        return $this->blocks->where('parent_id', null)->map(function ($block) use ($blockViewMappings, $renderChilds, $data) {
16
+        return $this->blocks->where('parent_id', null)->map(function($block) use ($blockViewMappings, $renderChilds, $data) {
17 17
             if ($renderChilds) {
18 18
                 $childBlocks = $this->blocks->where('parent_id', $block->id);
19 19
 
20
-                $renderedChildViews = $childBlocks->map(function ($childBlock) use ($blockViewMappings, $data) {
20
+                $renderedChildViews = $childBlocks->map(function($childBlock) use ($blockViewMappings, $data) {
21 21
                     $view = $this->getBlockView($childBlock->type, $blockViewMappings);
22 22
 
23 23
                     return view($view, $data)->with('block', $childBlock)->render();
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 
29 29
             $view = $this->getBlockView($block->type, $blockViewMappings);
30 30
 
31
-            return view($view, $data)->with('block', $block)->render().($renderedChildViews ?? '');
31
+            return view($view, $data)->with('block', $block)->render() . ($renderedChildViews ?? '');
32 32
         })->implode('');
33 33
     }
34 34
 
35 35
     private function getBlockView($blockType, $blockViewMappings = [])
36 36
     {
37
-        $view = config('twill.block_editor.block_views_path').'.'.$blockType;
37
+        $view = config('twill.block_editor.block_views_path') . '.' . $blockType;
38 38
 
39 39
         if (array_key_exists($blockType, $blockViewMappings)) {
40 40
             $view = $blockViewMappings[$blockType];
Please login to merge, or discard this patch.
src/Models/Behaviors/HasPresenter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     public function present($presenter = 'presenter')
10 10
     {
11 11
         if (!$this->$presenter or !class_exists($this->$presenter)) {
12
-            throw new \Exception('Please set the Presenter path to your Presenter :'.$presenter.' FQN');
12
+            throw new \Exception('Please set the Presenter path to your Presenter :' . $presenter . ' FQN');
13 13
         }
14 14
 
15 15
         if (!$this->presenterInstance) {
Please login to merge, or discard this patch.
src/Models/Behaviors/HasFiles.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
         $locale = $locale ?? app()->getLocale();
18 18
 
19 19
         if (!$file) {
20
-            $file = $this->files->first(function ($file) use ($role, $locale) {
20
+            $file = $this->files->first(function($file) use ($role, $locale) {
21 21
                 $localeScope = ($locale === 'fallback') ? true : ($file->pivot->locale === $locale);
22 22
 
23 23
                 return $file->pivot->role === $role && $localeScope;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     {
34 34
         $locale = $locale ?? app()->getLocale();
35 35
 
36
-        $files = $this->files->filter(function ($file) use ($role, $locale) {
36
+        $files = $this->files->filter(function($file) use ($role, $locale) {
37 37
             return $file->pivot->role === $role && $file->pivot->locale === $locale;
38 38
         });
39 39
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $locale = $locale ?? app()->getLocale();
52 52
 
53
-        return $this->files->first(function ($key, $file) use ($role, $locale) {
53
+        return $this->files->first(function($key, $file) use ($role, $locale) {
54 54
             return $file->pivot->role === $role && $file->pivot->locale === $locale;
55 55
         });
56 56
     }
Please login to merge, or discard this patch.
src/Models/Behaviors/HasTranslation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
     public function getTranslationModelNameDefault()
12 12
     {
13
-        return "App\Models\Translations\\".class_basename($this).'Translation';
13
+        return "App\Models\Translations\\" . class_basename($this) . 'Translation';
14 14
     }
15 15
 
16 16
     public function scopeWithActiveTranslations($query, $locale = null)
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
         if (method_exists($query->getModel(), 'translations')) {
19 19
             $locale = $locale == null ? app()->getLocale() : $locale;
20 20
 
21
-            $query->whereHas('translations', function ($query) use ($locale) {
21
+            $query->whereHas('translations', function($query) use ($locale) {
22 22
                 $query->whereActive(true);
23 23
                 $query->whereLocale($locale);
24 24
             });
25 25
 
26
-            return $query->with(['translations' => function ($query) use ($locale) {
26
+            return $query->with(['translations' => function($query) use ($locale) {
27 27
                 $query->whereActive(true);
28 28
                 $query->whereLocale($locale);
29 29
             }]);
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 
76 76
     public function getActiveLanguages()
77 77
     {
78
-        return $this->translations->map(function ($translation) {
78
+        return $this->translations->map(function($translation) {
79 79
             return [
80 80
                 'shortlabel' => strtoupper($translation->locale),
81 81
                 'label'      => getLanguageLabelFromLocaleCode($translation->locale),
82 82
                 'value'      => $translation->locale,
83 83
                 'published'  => $translation->active ?? false,
84 84
             ];
85
-        })->sortBy(function ($translation) {
85
+        })->sortBy(function($translation) {
86 86
             $localesOrdered = config('translatable.locales');
87 87
 
88 88
             return array_search($translation['value'], $localesOrdered);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function translatedAttribute($key)
93 93
     {
94
-        return $this->translations->mapWithKeys(function ($translation) use ($key) {
94
+        return $this->translations->mapWithKeys(function($translation) use ($key) {
95 95
             return [$translation->locale => $this->translate($translation->locale)->$key];
96 96
         });
97 97
     }
Please login to merge, or discard this patch.
src/Models/Behaviors/HasPosition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 {
7 7
     protected static function bootHasPosition()
8 8
     {
9
-        static::creating(function ($model) {
9
+        static::creating(function($model) {
10 10
             $model->setToLastPosition();
11 11
         });
12 12
     }
Please login to merge, or discard this patch.
src/Models/Behaviors/HasRevisions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@
 block discarded – undo
6 6
 {
7 7
     public function revisions()
8 8
     {
9
-        return $this->hasMany("App\Models\Revisions\\".class_basename($this).'Revision')->orderBy('created_at', 'desc');
9
+        return $this->hasMany("App\Models\Revisions\\" . class_basename($this) . 'Revision')->orderBy('created_at', 'desc');
10 10
     }
11 11
 
12 12
     public function scopeMine($query)
13 13
     {
14
-        return $query->whereHas('revisions', function ($query) {
14
+        return $query->whereHas('revisions', function($query) {
15 15
             $query->where('user_id', auth()->user()->id);
16 16
         });
17 17
     }
18 18
 
19 19
     public function revisionsArray()
20 20
     {
21
-        return $this->revisions->map(function ($revision) {
21
+        return $this->revisions->map(function($revision) {
22 22
             return [
23 23
                 'id'       => $revision->id,
24 24
                 'author'   => $revision->user->name ?? 'Unknown',
Please login to merge, or discard this patch.
src/RouteServiceProvider.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,48 +25,48 @@  discard block
 block discarded – undo
25 25
     public function map(Router $router)
26 26
     {
27 27
         $router->group([
28
-            'namespace'  => config('twill.namespace', 'App').'\Http\Controllers\Admin',
28
+            'namespace'  => config('twill.namespace', 'App') . '\Http\Controllers\Admin',
29 29
             'domain'     => config('twill.admin_app_url'),
30 30
             'as'         => 'admin.',
31 31
             'middleware' => [config('twill.admin_middleware_group', 'web')],
32 32
             'prefix'     => rtrim(ltrim(config('twill.admin_app_path'), '/'), '/'),
33
-        ], function ($router) {
34
-            $router->group(['middleware' => ['auth', 'impersonate', 'validateBackHistory']], function ($router) {
33
+        ], function($router) {
34
+            $router->group(['middleware' => ['auth', 'impersonate', 'validateBackHistory']], function($router) {
35 35
                 require base_path('routes/admin.php');
36 36
             });
37 37
         });
38 38
 
39 39
         $router->group([
40
-            'namespace'  => $this->namespace.'\Admin',
40
+            'namespace'  => $this->namespace . '\Admin',
41 41
             'domain'     => config('twill.admin_app_url'),
42 42
             'as'         => 'admin.',
43 43
             'middleware' => [config('twill.admin_middleware_group', 'web')],
44 44
             'prefix'     => rtrim(ltrim(config('twill.admin_app_path'), '/'), '/'),
45 45
         ],
46
-            function ($router) {
47
-                $router->group(['middleware' => ['auth', 'impersonate', 'validateBackHistory']], function ($router) {
48
-                    require __DIR__.'/../routes/admin.php';
46
+            function($router) {
47
+                $router->group(['middleware' => ['auth', 'impersonate', 'validateBackHistory']], function($router) {
48
+                    require __DIR__ . '/../routes/admin.php';
49 49
                 });
50 50
 
51
-                $router->group(['middleware' => ['noDebugBar']], function ($router) {
52
-                    require __DIR__.'/../routes/auth.php';
51
+                $router->group(['middleware' => ['noDebugBar']], function($router) {
52
+                    require __DIR__ . '/../routes/auth.php';
53 53
                 });
54 54
 
55
-                $router->group(['middleware' => array_merge(['noDebugBar'], (app()->environment('production') ? ['auth'] : []))], function ($router) {
56
-                    require __DIR__.'/../routes/templates.php';
55
+                $router->group(['middleware' => array_merge(['noDebugBar'], (app()->environment('production') ? ['auth'] : []))], function($router) {
56
+                    require __DIR__ . '/../routes/templates.php';
57 57
                 });
58 58
             }
59 59
         );
60 60
 
61 61
         if (config('twill.templates_on_frontend_domain')) {
62 62
             $router->group([
63
-                'namespace'  => $this->namespace.'\Admin',
63
+                'namespace'  => $this->namespace . '\Admin',
64 64
                 'domain'     => config('app.url'),
65 65
                 'middleware' => [config('twill.admin_middleware_group', 'web')],
66 66
             ],
67
-                function ($router) {
68
-                    $router->group(['middleware' => array_merge(['noDebugBar'], (app()->environment('production') ? ['auth'] : []))], function ($router) {
69
-                        require __DIR__.'/../routes/templates.php';
67
+                function($router) {
68
+                    $router->group(['middleware' => array_merge(['noDebugBar'], (app()->environment('production') ? ['auth'] : []))], function($router) {
69
+                        require __DIR__ . '/../routes/templates.php';
70 70
                     });
71 71
                 }
72 72
             );
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
     protected function registerMacros()
90 90
     {
91
-        Route::macro('moduleShowWithPreview', function ($moduleName, $routePrefix = null, $controllerName = null) {
91
+        Route::macro('moduleShowWithPreview', function($moduleName, $routePrefix = null, $controllerName = null) {
92 92
             if ($routePrefix === null) {
93 93
                 $routePrefix = $moduleName;
94 94
             }
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
                 $controllerName = ucfirst(str_plural($moduleName));
98 98
             }
99 99
 
100
-            $routePrefix = empty($routePrefix) ? '/' : (starts_with($routePrefix, '/') ? $routePrefix : '/'.$routePrefix);
101
-            $routePrefix = ends_with($routePrefix, '/') ? $routePrefix : $routePrefix.'/';
100
+            $routePrefix = empty($routePrefix) ? '/' : (starts_with($routePrefix, '/') ? $routePrefix : '/' . $routePrefix);
101
+            $routePrefix = ends_with($routePrefix, '/') ? $routePrefix : $routePrefix . '/';
102 102
 
103
-            Route::name($moduleName.'.show')->get($routePrefix.'{slug}', $controllerName.'Controller@show');
104
-            Route::name($moduleName.'.preview')->get('/admin-preview'.$routePrefix.'{slug}', $controllerName.'Controller@show')->middleware(['web', 'auth', 'can:list']);
103
+            Route::name($moduleName . '.show')->get($routePrefix . '{slug}', $controllerName . 'Controller@show');
104
+            Route::name($moduleName . '.preview')->get('/admin-preview' . $routePrefix . '{slug}', $controllerName . 'Controller@show')->middleware(['web', 'auth', 'can:list']);
105 105
         });
106 106
 
107
-        Route::macro('module', function ($slug, $options = [], $resource_options = [], $resource = true) {
107
+        Route::macro('module', function($slug, $options = [], $resource_options = [], $resource = true) {
108 108
             $slugs = explode('.', $slug);
109 109
             $prefixSlug = str_replace('.', '/', $slug);
110 110
             $_slug = Arr::last($slugs);
111
-            $className = implode('', array_map(function ($s) {
111
+            $className = implode('', array_map(function($s) {
112 112
                 return ucfirst(str_singular($s));
113 113
             }, $slugs));
114 114
 
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
 
131 131
             foreach ($customRoutes as $route) {
132 132
                 $routeSlug = "{$prefixSlug}/{$route}";
133
-                $mapping = ['as' => $customRoutePrefix.".{$route}", 'uses' => "{$className}Controller@{$route}"];
133
+                $mapping = ['as' => $customRoutePrefix . ".{$route}", 'uses' => "{$className}Controller@{$route}"];
134 134
 
135 135
                 if (in_array($route, ['browser', 'tags'])) {
136 136
                     Route::get($routeSlug, $mapping);
137 137
                 }
138 138
 
139 139
                 if (in_array($route, ['status'])) {
140
-                    Route::get($routeSlug.'/{id}', $mapping);
140
+                    Route::get($routeSlug . '/{id}', $mapping);
141 141
                 }
142 142
 
143 143
                 if (in_array($route, ['publish', 'feature', 'restore', 'restoreRevision'])) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                 }
146 146
 
147 147
                 if (in_array($route, ['preview'])) {
148
-                    Route::put($routeSlug.'/{id}', $mapping);
148
+                    Route::put($routeSlug . '/{id}', $mapping);
149 149
                 }
150 150
 
151 151
                 if (in_array($route, ['reorder', 'bulkPublish', 'bulkFeature', 'bulkDelete', 'bulkRestore'])) {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
             if ($resource) {
157 157
                 $customRoutePrefix = !empty($groupPrefix) ? "{$groupPrefix}." : '';
158
-                Route::group(['as' => $customRoutePrefix], function () use ($slug, $className, $resource_options) {
158
+                Route::group(['as' => $customRoutePrefix], function() use ($slug, $className, $resource_options) {
159 159
                     Route::resource($slug, "{$className}Controller", $resource_options);
160 160
                 });
161 161
             }
Please login to merge, or discard this patch.