Completed
Push — master ( c9b1f2...7edc4b )
by Gino
02:53 queued 01:13
created
Plugin.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     public function registerNavigation(): void
134 134
     {
135 135
         // Extend the navigation
136
-        Event::listen('backend.menu.extendItems', function ($manager) {
136
+        Event::listen('backend.menu.extendItems', function($manager) {
137 137
             $manager->addSideMenuItems(self::REQUIRED_PLUGIN_RAINLAB_BLOG, 'blog', [
138 138
                 'series' => [
139 139
                     'label' => self::LOCALIZATION_KEY . 'navigation.sidebar.series',
@@ -194,47 +194,47 @@  discard block
 block discarded – undo
194 194
      */
195 195
     private function extendPostModel(): void
196 196
     {
197
-        PostModel::extend(function ($model) {
197
+        PostModel::extend(function($model) {
198 198
             $model->morphToMany = [
199
-                'tags' => [Tag::class, 'name' => Tag::PIVOT_COLUMN]
199
+                'tags' => [ Tag::class, 'name' => Tag::PIVOT_COLUMN ]
200 200
             ];
201 201
 
202
-            $model->belongsTo['series'] = [
202
+            $model->belongsTo[ 'series' ] = [
203 203
                 Series::class,
204 204
                 'key' => Series::TABLE_NAME . "_id"
205 205
             ];
206 206
 
207 207
             if ($this->getSettings()->postTypesEnabled()) {
208
-                $model->belongsTo['post_type'] = [
208
+                $model->belongsTo[ 'post_type' ] = [
209 209
                     PostType::class,
210 210
                     'key' => PostType::TABLE_NAME . "_id"
211 211
                 ];
212 212
 
213
-                $model->addJsonable(PostType::TABLE_NAME. '_attributes');
213
+                $model->addJsonable(PostType::TABLE_NAME . '_attributes');
214 214
 
215 215
                 $model->addDynamicMethod('typeAttributes', function() use ($model) {
216 216
                     if (!empty($model->post_type->id)) {
217
-                        $rawFields = $model->{PostType::TABLE_NAME. '_attributes'}[0] ?? [];
218
-                        $prefix = $model->post_type->id.'.';
219
-                        $fields = [];
217
+                        $rawFields = $model->{PostType::TABLE_NAME . '_attributes'}[ 0 ] ?? [ ];
218
+                        $prefix = $model->post_type->id . '.';
219
+                        $fields = [ ];
220 220
 
221 221
                         foreach ($rawFields as $code => $value) {
222 222
                             if (strpos($code, $prefix) === 0) {
223
-                                $fields[str_replace($prefix, '', $code)] = $value;
223
+                                $fields[ str_replace($prefix, '', $code) ] = $value;
224 224
                             }
225 225
                         }
226 226
 
227 227
                         return $fields;
228 228
                     }
229 229
 
230
-                    return [];
230
+                    return [ ];
231 231
                 });
232 232
 
233 233
                 $model->addDynamicMethod('typeAttribute', function(string $code) use ($model) {
234 234
                     if (!empty($model->post_type->id)) {
235 235
                         $attributeKey = sprintf('%s.%s', $model->post_type->id, $code);
236 236
 
237
-                        return $model->{PostType::TABLE_NAME. '_attributes'}[0][$attributeKey] ?? null;
237
+                        return $model->{PostType::TABLE_NAME . '_attributes'}[ 0 ][ $attributeKey ] ?? null;
238 238
                     }
239 239
 
240 240
                     return $model->post_type->id;
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     private function extendPostsController(): void
262 262
     {
263
-        PostsController::extendFormFields(function (Form $form, $model) {
263
+        PostsController::extendFormFields(function(Form $form, $model) {
264 264
             if (!$model instanceof PostModel) {
265 265
                 return;
266 266
             }
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
      */
312 312
     private function extendCategoriesController(): void
313 313
     {
314
-        CategoriesController::extend(function (Controller $controller) {
315
-            $controller->implement[] = RelationController::class;
314
+        CategoriesController::extend(function(Controller $controller) {
315
+            $controller->implement[ ] = RelationController::class;
316 316
             $relationConfig = '$/' . self::DIRECTORY_KEY . '/controllers/category/config_relation.yaml';
317 317
 
318 318
             if (property_exists($controller, 'relationConfig')) {
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
 
340 340
     private function extendCategoriesModel(): void
341 341
     {
342
-        CategoryModel::extend(function ($model) {
342
+        CategoryModel::extend(function($model) {
343 343
             if ($this->getSettings()->postCategoriesCoverImageEnabled()) {
344
-                $model->attachOne['cover_image'] = [
344
+                $model->attachOne[ 'cover_image' ] = [
345 345
                     File::class, 'delete' => true
346 346
                 ];
347 347
             }
348 348
 
349 349
             if ($this->getSettings()->postCategoriesFeaturedImagesEnabled()) {
350
-                $model->attachMany['featured_images'] = [
350
+                $model->attachMany[ 'featured_images' ] = [
351 351
                     File::class, 'order' => 'sort_order', 'delete' => true
352 352
                 ];
353 353
             }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
     private function extendCategoriesFormFields(): void
358 358
     {
359
-        CategoriesController::extendFormFields(function ($form, $model) {
359
+        CategoriesController::extendFormFields(function($form, $model) {
360 360
             if (!$model instanceof CategoryModel) {
361 361
                 return;
362 362
             }
@@ -401,15 +401,15 @@  discard block
 block discarded – undo
401 401
     private function extendValidator(): void
402 402
     {
403 403
         if ($this->getSettings()->postTypesEnabled()) {
404
-            Validator::extend('unique_in_repeater', function ($attribute, $value, $parameters, $validator) {
404
+            Validator::extend('unique_in_repeater', function($attribute, $value, $parameters, $validator) {
405 405
                 $attributeNameParts = explode('.', $attribute);
406 406
 
407 407
                 $repeaterName = reset($attributeNameParts);
408 408
                 $fieldName = end($attributeNameParts);
409 409
 
410
-                $repeaterData = isset($validator->getData()[$repeaterName])
411
-                    ? (array) $validator->getData()[$repeaterName]
412
-                    : [];
410
+                $repeaterData = isset($validator->getData()[ $repeaterName ])
411
+                    ? (array)$validator->getData()[ $repeaterName ]
412
+                    : [ ];
413 413
 
414 414
                 $fieldData = array_column($repeaterData, $fieldName);
415 415
 
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
     private function transformPostCategoriesIntoTaglist(Form $form, string $tab)
426 426
     {
427 427
         $categoriesConfig = $form->getField('categories')->config;
428
-        $categoriesConfig['tab'] = $tab;
429
-        $categoriesConfig['mode'] = 'relation';
430
-        $categoriesConfig['type'] = 'taglist';
431
-        $categoriesConfig['label'] = 'rainlab.blog::lang.post.tab_categories';
432
-        $categoriesConfig['comment'] = "rainlab.blog::lang.post.categories_comment";
433
-        $categoriesConfig['placeholder'] = self::LOCALIZATION_KEY . 'placeholders.categories';
434
-        unset($categoriesConfig['commentAbove']);
428
+        $categoriesConfig[ 'tab' ] = $tab;
429
+        $categoriesConfig[ 'mode' ] = 'relation';
430
+        $categoriesConfig[ 'type' ] = 'taglist';
431
+        $categoriesConfig[ 'label' ] = 'rainlab.blog::lang.post.tab_categories';
432
+        $categoriesConfig[ 'comment' ] = "rainlab.blog::lang.post.categories_comment";
433
+        $categoriesConfig[ 'placeholder' ] = self::LOCALIZATION_KEY . 'placeholders.categories';
434
+        unset($categoriesConfig[ 'commentAbove' ]);
435 435
 
436 436
         $form->removeField('categories');
437 437
         return $categoriesConfig;
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
         $condition = implode(
456 456
             array_map(
457
-                static function ($value) {
457
+                static function($value) {
458 458
                     return "[$value]";
459 459
                 },
460 460
                 PostType::all()->pluck('id')->toArray()
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
             'style' => 'accordion',
481 481
             'tab' => $tab,
482 482
             'form' => [
483
-                'fields' => []
483
+                'fields' => [ ]
484 484
             ]
485 485
         ];
486 486
 
@@ -490,51 +490,51 @@  discard block
 block discarded – undo
490 490
             (!empty($model->id) && !empty($model->post_type->id) && $postType = $model->post_type)
491 491
         ) {
492 492
             if (!empty($postType->type_attributes)) {
493
-                $fields = [];
493
+                $fields = [ ];
494 494
 
495 495
                 foreach ($postType->type_attributes as $typeAttribute) {
496
-                    if (empty($typeAttribute['code'])) {
496
+                    if (empty($typeAttribute[ 'code' ])) {
497 497
                         continue;
498 498
                     }
499 499
 
500
-                    $field = [];
500
+                    $field = [ ];
501 501
 
502
-                    $type = $typeAttribute['type'] ?? 'text';
502
+                    $type = $typeAttribute[ 'type' ] ?? 'text';
503 503
 
504 504
                     switch ($type) {
505 505
                         case 'file':
506 506
                         case 'image':
507
-                            $field['type'] = 'mediafinder';
508
-                            $field['mode'] = $type;
509
-                            $field['imageWidth'] = 200;
507
+                            $field[ 'type' ] = 'mediafinder';
508
+                            $field[ 'mode' ] = $type;
509
+                            $field[ 'imageWidth' ] = 200;
510 510
                             break;
511 511
                         case 'dropdown':
512
-                            $field['type'] = $type;
512
+                            $field[ 'type' ] = $type;
513 513
 
514
-                            $options = array_map(static function ($value) {
514
+                            $options = array_map(static function($value) {
515 515
                                 return trim($value);
516
-                            }, explode(',', $typeAttribute['dropdown_options'] ?? ''));
516
+                            }, explode(',', $typeAttribute[ 'dropdown_options' ] ?? ''));
517 517
 
518
-                            $field['options'] = $options;
518
+                            $field[ 'options' ] = $options;
519 519
 
520 520
                             break;
521 521
                         case 'text':
522 522
                         case 'textarea':
523
-                            $field['type'] = $type;
523
+                            $field[ 'type' ] = $type;
524 524
                             break;
525 525
                         case 'datepicker':
526
-                            $field['type'] = $type;
527
-                            $field['mode'] = $typeAttribute['datepicker_mode'] ?? 'date';
526
+                            $field[ 'type' ] = $type;
527
+                            $field[ 'mode' ] = $typeAttribute[ 'datepicker_mode' ] ?? 'date';
528 528
 
529 529
                             break;
530 530
                     }
531 531
 
532
-                    $field['label'] = $typeAttribute['name'] ?? '';
532
+                    $field[ 'label' ] = $typeAttribute[ 'name' ] ?? '';
533 533
 
534
-                    $fields[sprintf("%s.%s", $postType->id, $typeAttribute['code'])] = $field;
534
+                    $fields[ sprintf("%s.%s", $postType->id, $typeAttribute[ 'code' ]) ] = $field;
535 535
                 }
536 536
 
537
-                $typeAttributes['form']['fields'] = $fields;
537
+                $typeAttributes[ 'form' ][ 'fields' ] = $fields;
538 538
             }
539 539
         }
540 540
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 
546 546
     private function extendPostListColumns(): void
547 547
     {
548
-        Event::listen('backend.list.extendColumns', function (Lists $listWidget) {
548
+        Event::listen('backend.list.extendColumns', function(Lists $listWidget) {
549 549
             // Only for the Posts controller
550 550
             if (!$listWidget->getController() instanceof PostsController) {
551 551
                 return;
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
     private function extendPostFilterScopes(): void
574 574
     {
575
-        Event::listen('backend.filter.extendScopes', function (Filter $filterWidget) {
575
+        Event::listen('backend.filter.extendScopes', function(Filter $filterWidget) {
576 576
             if ($this->getSettings()->postTypesEnabled()) {
577 577
                 $filterWidget->addScopes([
578 578
                     'type' => [
Please login to merge, or discard this patch.
controllers/PostTypes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $postType = PostType::whereId($recordId)->first();
58 58
 
59 59
         if ($postType !== null) {
60
-            $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.post_types.edit_title', ['post_type' => $postType->name]);
60
+            $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.post_types.edit_title', [ 'post_type' => $postType->name ]);
61 61
         } else {
62 62
             $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.post_types.post_type_does_not_exist');
63 63
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function onBulkDelete()
74 74
     {
75
-        if ($checkedIds = (array)post('checked', [])) {
75
+        if ($checkedIds = (array)post('checked', [ ])) {
76 76
             $delete = PostType::whereIn('id', $checkedIds)->delete();
77 77
         }
78 78
 
Please login to merge, or discard this patch.
components/TagPosts.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     protected function prepareContextItem()
78 78
     {
79 79
         // load tag
80
-        $this->tag = $this->page['tag'] = Tag::whereTranslatable('slug', $this->property('tag'))->first();
80
+        $this->tag = $this->page[ 'tag' ] = Tag::whereTranslatable('slug', $this->property('tag'))->first();
81 81
 
82 82
         return $this->tag;
83 83
     }
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
      */
88 88
     protected function getPostsQuery()
89 89
     {
90
-        $query = Post::whereHas('tags', function ($query) {
90
+        $query = Post::whereHas('tags', function($query) {
91 91
             $query->whereTranslatable('slug', $this->tag->slug);
92 92
         });
93 93
 
94 94
         if ($this->includeSeriesPosts) {
95
-            $query->orWhereHas('series', function ($query) {
96
-                $query->whereHas('tags', function ($query) {
95
+            $query->orWhereHas('series', function($query) {
96
+                $query->whereHas('tags', function($query) {
97 97
                     $query->whereTranslatable('slug', $this->tag->slug);
98 98
                 });
99 99
             });
Please login to merge, or discard this patch.
updates/create_taxonomies_tables.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
      */
54 54
     private function dropSeries()
55 55
     {
56
-        Schema::table('rainlab_blog_posts', static function ($table) {
57
-            $table->dropForeign([Series::TABLE_NAME . '_id']);
56
+        Schema::table('rainlab_blog_posts', static function($table) {
57
+            $table->dropForeign([ Series::TABLE_NAME . '_id' ]);
58 58
         });
59 59
 
60 60
         if (Schema::hasColumn('rainlab_blog_posts', Series::TABLE_NAME . '_id')) {
61
-            Schema::table('rainlab_blog_posts', static function ($table) {
61
+            Schema::table('rainlab_blog_posts', static function($table) {
62 62
                 $table->dropColumn(Series::TABLE_NAME . '_id');
63 63
             });
64 64
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         if (!Schema::hasTable(Tag::TABLE_NAME)) {
75 75
             Schema::create(
76 76
                 Tag::TABLE_NAME,
77
-                static function ($table) {
77
+                static function($table) {
78 78
                     $table->engine = 'InnoDB';
79 79
 
80 80
                     $table->increments('id');
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
         if (!Schema::hasTable(Tag::CROSS_REFERENCE_TABLE_NAME)) {
89 89
             Schema::create(
90 90
                 Tag::CROSS_REFERENCE_TABLE_NAME,
91
-                static function ($table) {
91
+                static function($table) {
92 92
                     $table->engine = 'InnoDB';
93 93
 
94 94
                     $table->integer('tag_id')->unsigned()->nullable()->default(null);
95 95
                     $table->integer('post_id')->unsigned()->nullable()->default(null);
96
-                    $table->index(['tag_id', 'post_id']);
96
+                    $table->index([ 'tag_id', 'post_id' ]);
97 97
                     $table->foreign('tag_id')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade');
98 98
                     $table->foreign('post_id')->references('id')->on('rainlab_blog_posts')->onDelete('cascade');
99 99
                 }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         if (!Schema::hasTable(Series::TABLE_NAME)) {
110 110
             Schema::create(
111 111
                 Series::TABLE_NAME,
112
-                static function ($table) {
112
+                static function($table) {
113 113
                     $table->engine = 'InnoDB';
114 114
 
115 115
                     $table->increments('id');
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                 }
121 121
             );
122 122
 
123
-            Schema::table('rainlab_blog_posts', function ($table) {
123
+            Schema::table('rainlab_blog_posts', function($table) {
124 124
                 $table->integer(Series::TABLE_NAME . '_id')->unsigned()->nullable()->default(null);
125 125
                 $table->foreign(Series::TABLE_NAME . '_id')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade');
126 126
             });
Please login to merge, or discard this patch.
updates/drop_deprecated_post_tag_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
         if (!Schema::hasTable('ginopane_blogtaxonomy_post_tag')) {
30 30
             Schema::create(
31 31
                 'ginopane_blogtaxonomy_post_tag',
32
-                static function ($table) {
32
+                static function($table) {
33 33
                     $table->engine = 'InnoDB';
34 34
 
35 35
                     $table->integer('tag_id')->unsigned()->nullable()->default(null);
36 36
                     $table->integer('post_id')->unsigned()->nullable()->default(null);
37
-                    $table->index(['tag_id', 'post_id']);
37
+                    $table->index([ 'tag_id', 'post_id' ]);
38 38
                     $table->foreign('tag_id')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade');
39 39
                     $table->foreign('post_id')->references('id')->on('rainlab_blog_posts')->onDelete('cascade');
40 40
                 }
Please login to merge, or discard this patch.
updates/create_post_type_table.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
      */
77 77
     private function dropPostTypes()
78 78
     {
79
-        Schema::table('rainlab_blog_posts', static function ($table) {
80
-            $table->dropForeign([PostType::TABLE_NAME . '_id']);
79
+        Schema::table('rainlab_blog_posts', static function($table) {
80
+            $table->dropForeign([ PostType::TABLE_NAME . '_id' ]);
81 81
 
82
-            $table->dropColumn(PostType::TABLE_NAME. '_attributes');
82
+            $table->dropColumn(PostType::TABLE_NAME . '_attributes');
83 83
         });
84 84
 
85 85
         if (Schema::hasColumn('rainlab_blog_posts', PostType::TABLE_NAME . '_id')) {
86
-            Schema::table('rainlab_blog_posts', static function ($table) {
86
+            Schema::table('rainlab_blog_posts', static function($table) {
87 87
                 $table->dropColumn(PostType::TABLE_NAME . '_id');
88 88
             });
89 89
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         if (!Schema::hasTable(PostType::TABLE_NAME)) {
100 100
             Schema::create(
101 101
                 PostType::TABLE_NAME,
102
-                static function ($table) {
102
+                static function($table) {
103 103
                     $table->engine = 'InnoDB';
104 104
 
105 105
                     $table->increments('id');
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
                 }
112 112
             );
113 113
 
114
-            Schema::table('rainlab_blog_posts', function ($table) {
114
+            Schema::table('rainlab_blog_posts', function($table) {
115 115
                 $table->integer(PostType::TABLE_NAME . '_id')->unsigned()->nullable()->default(null);
116 116
                 $table->foreign(PostType::TABLE_NAME . '_id')->references('id')->on(PostType::TABLE_NAME)->onDelete('cascade');
117 117
 
118
-                $table->json(PostType::TABLE_NAME. '_attributes')->nullable();
118
+                $table->json(PostType::TABLE_NAME . '_attributes')->nullable();
119 119
             });
120 120
 
121 121
             DB::table(PostType::TABLE_NAME)->insert(
Please login to merge, or discard this patch.
models/Settings.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     const POST_CATEGORIES_COVER_IMAGES_ENABLED_KEY = 'post_categories_cover_image_enabled';
19 19
     const POST_CATEGORIES_FEATURED_IMAGES_ENABLED_KEY = 'post_categories_featured_images_enabled';
20 20
 
21
-    public $implement = [SettingsModel::class];
21
+    public $implement = [ SettingsModel::class ];
22 22
 
23 23
     public $settingsCode = self::SETTINGS_CODE;
24 24
 
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function postTypesEnabled() : bool
28 28
     {
29
-        return (bool) $this->{self::POST_TYPES_ENABLED_KEY};
29
+        return (bool)$this->{self::POST_TYPES_ENABLED_KEY};
30 30
     }
31 31
 
32 32
     public function postCategoriesCoverImageEnabled() : bool
33 33
     {
34
-        return (bool) $this->{self::POST_CATEGORIES_COVER_IMAGES_ENABLED_KEY};
34
+        return (bool)$this->{self::POST_CATEGORIES_COVER_IMAGES_ENABLED_KEY};
35 35
     }
36 36
 
37 37
     public function postCategoriesFeaturedImagesEnabled() : bool
38 38
     {
39
-        return (bool) $this->{self::POST_CATEGORIES_FEATURED_IMAGES_ENABLED_KEY};
39
+        return (bool)$this->{self::POST_CATEGORIES_FEATURED_IMAGES_ENABLED_KEY};
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
models/PostType.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @var array
43 43
      */
44
-    public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
44
+    public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ];
45 45
 
46 46
     /**
47 47
      * @var array Attributes to be stored as JSON
48 48
      */
49
-    protected $jsonable = ['type_attributes'];
49
+    protected $jsonable = [ 'type_attributes' ];
50 50
 
51 51
     /**
52 52
      * Translatable properties, indexed property will be available in queries
@@ -103,5 +103,5 @@  discard block
 block discarded – undo
103 103
         'type_attributes.*.name.unique_in_repeater' => Plugin::LOCALIZATION_KEY . 'form.post_types.type_attributes_name_unique',
104 104
     ];
105 105
 
106
-    protected $slugs = ['slug' => 'name'];
106
+    protected $slugs = [ 'slug' => 'name' ];
107 107
 }
Please login to merge, or discard this patch.
models/Tag.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @var array
46 46
      */
47
-    public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
47
+    public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ];
48 48
 
49 49
     /**
50 50
      * Translatable properties, indexed property will be available in queries
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * @var array
64 64
      */
65
-    protected $slugs = ['slug' => 'name'];
65
+    protected $slugs = [ 'slug' => 'name' ];
66 66
 
67 67
     /**
68 68
      * Relations
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
      * @var array
71 71
      */
72 72
     public $morphedByMany = [
73
-        'posts'  => [Post::class, 'name' => Tag::PIVOT_COLUMN],
74
-        'series'  => [Series::class, 'name' => Tag::PIVOT_COLUMN],
73
+        'posts'  => [ Post::class, 'name' => Tag::PIVOT_COLUMN ],
74
+        'series'  => [ Series::class, 'name' => Tag::PIVOT_COLUMN ],
75 75
     ];
76 76
 
77 77
     /**
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
     {
196 196
         parent::queryPostSlug($query, $options);
197 197
 
198
-        if (!empty($options['post']) && !empty($options['includeSeriesTags'])) {
199
-            $query->orWhereHas('series', static function ($query) use ($options) {
198
+        if (!empty($options[ 'post' ]) && !empty($options[ 'includeSeriesTags' ])) {
199
+            $query->orWhereHas('series', static function($query) use ($options) {
200 200
                 $query->whereHas(
201 201
                     'posts',
202
-                    static function ($query) use ($options) {
203
-                        ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']);
202
+                    static function($query) use ($options) {
203
+                        ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]);
204 204
                     }
205 205
                 );
206 206
             });
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     protected function queryDisplayEmpty(Builder $query, array $options)
217 217
     {
218
-        if (empty($options['displayEmpty'])) {
218
+        if (empty($options[ 'displayEmpty' ])) {
219 219
             $query
220 220
                 ->having('posts_count', '>', 0)
221 221
                 ->orHaving('series_count', '>', 0);
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
      */
231 231
     private function postRelation(Builder $query, array $options)
232 232
     {
233
-        if (!empty($options['fetchPosts'])) {
233
+        if (!empty($options[ 'fetchPosts' ])) {
234 234
             $query->with(
235 235
                 [
236
-                    'posts' => static function (MorphToMany $query) use ($options) {
236
+                    'posts' => static function(MorphToMany $query) use ($options) {
237 237
                         $query->isPublished();
238 238
 
239 239
                         self::handleExceptions($query->getQuery(), $options);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
         $query->withCount(
246 246
             [
247
-                'posts' => static function ($query) use ($options) {
247
+                'posts' => static function($query) use ($options) {
248 248
                     $query->isPublished();
249 249
 
250 250
                     self::handleExceptions($query, $options);
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
     {
264 264
         $query->withCount('series');
265 265
 
266
-        if (!empty($options['fetchSeriesPostCount'])) {
266
+        if (!empty($options[ 'fetchSeriesPostCount' ])) {
267 267
             $query->with(
268 268
                 [
269
-                    'series' => static function (MorphToMany $query) use ($options) {
269
+                    'series' => static function(MorphToMany $query) use ($options) {
270 270
                         $query->withCount(
271 271
                             [
272
-                                'posts' => static function ($query) use ($options) {
272
+                                'posts' => static function($query) use ($options) {
273 273
                                     $query->isPublished();
274 274
 
275 275
                                     self::handleExceptions($query, $options);
Please login to merge, or discard this patch.