Completed
Push — master ( c18609...6b3d0e )
by Gino
03:12 queued 01:16
created
models/Tag.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @var array
48 48
      */
49
-    public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
49
+    public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ];
50 50
 
51 51
     /**
52 52
      * Translatable properties, indexed property will be available in queries
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * @var array
66 66
      */
67
-    protected $slugs = ['slug' => 'name'];
67
+    protected $slugs = [ 'slug' => 'name' ];
68 68
 
69 69
     /**
70 70
      * Relations
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
      * @var array
73 73
      */
74 74
     public $morphedByMany = [
75
-        'posts'  => [Post::class, 'name' => Tag::PIVOT_COLUMN],
76
-        'series'  => [Series::class, 'name' => Tag::PIVOT_COLUMN],
75
+        'posts'  => [ Post::class, 'name' => Tag::PIVOT_COLUMN ],
76
+        'series'  => [ Series::class, 'name' => Tag::PIVOT_COLUMN ],
77 77
     ];
78 78
 
79 79
     /**
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
     {
183 183
         parent::queryPostSlug($query, $options);
184 184
 
185
-        if (!empty($options['post']) && !empty($options['includeSeriesTags'])) {
186
-            $query->orWhereHas('series', static function ($query) use ($options) {
185
+        if (!empty($options[ 'post' ]) && !empty($options[ 'includeSeriesTags' ])) {
186
+            $query->orWhereHas('series', static function($query) use ($options) {
187 187
                 $query->whereHas(
188 188
                     'posts',
189
-                    static function ($query) use ($options) {
190
-                        ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']);
189
+                    static function($query) use ($options) {
190
+                        ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]);
191 191
                     });
192 192
             });
193 193
         }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     protected function queryDisplayEmpty(Builder $query, array $options)
203 203
     {
204
-        if (empty($options['displayEmpty'])) {
204
+        if (empty($options[ 'displayEmpty' ])) {
205 205
             $query
206 206
                 ->having('posts_count', '>', 0)
207 207
                 ->orHaving('series_count', '>', 0);
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
      */
217 217
     private function postRelation(Builder $query, array $options)
218 218
     {
219
-        if (!empty($options['fetchPosts'])) {
219
+        if (!empty($options[ 'fetchPosts' ])) {
220 220
             $query->with(
221 221
                 [
222
-                    'posts' => static function (MorphToMany $query) use ($options) {
222
+                    'posts' => static function(MorphToMany $query) use ($options) {
223 223
                         $query->isPublished();
224 224
 
225 225
                         self::handleExceptions($query->getQuery(), $options);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
         $query->withCount(
232 232
             [
233
-                'posts' => static function ($query) use ($options) {
233
+                'posts' => static function($query) use ($options) {
234 234
                     $query->isPublished();
235 235
 
236 236
                     self::handleExceptions($query, $options);
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
     {
250 250
         $query->withCount('series');
251 251
 
252
-        if (!empty($options['fetchSeriesPostCount'])) {
252
+        if (!empty($options[ 'fetchSeriesPostCount' ])) {
253 253
             $query->with(
254 254
                 [
255
-                    'series' => static function (MorphToMany $query) use ($options) {
255
+                    'series' => static function(MorphToMany $query) use ($options) {
256 256
                         $query->withCount(
257 257
                             [
258
-                                'posts' => static function ($query) use ($options) {
258
+                                'posts' => static function($query) use ($options) {
259 259
                                     $query->isPublished();
260 260
 
261 261
                                     self::handleExceptions($query, $options);
Please login to merge, or discard this patch.
models/ModelAbstract.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * @var array
22 22
      */
23
-    public static $sortingOptions = [];
23
+    public static $sortingOptions = [ ];
24 24
 
25 25
     /**
26 26
      * Sets the URL attribute with a URL to this object
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @return mixed
55 55
      */
56
-    public function scopeListFrontend(Builder $query, array $options = [])
56
+    public function scopeListFrontend(Builder $query, array $options = [ ])
57 57
     {
58 58
         $this->withRelation($query, $options);
59 59
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     protected function queryDisplayEmpty(Builder $query, array $options)
105 105
     {
106
-        if (empty($options['displayEmpty'])) {
106
+        if (empty($options[ 'displayEmpty' ])) {
107 107
             $query
108 108
                 ->having('posts_count', '>', 0);
109 109
         }
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected function queryPostSlug(Builder $query, array $options)
119 119
     {
120
-        if (!empty($options['post'])) {
120
+        if (!empty($options[ 'post' ])) {
121 121
             $query->whereHas(
122 122
                 'posts',
123
-                static function ($query) use ($options) {
124
-                    ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']);
123
+                static function($query) use ($options) {
124
+                    ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]);
125 125
                 }
126 126
             );
127 127
         }
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
      */
136 136
     private function queryLimit(Builder $query, array $options)
137 137
     {
138
-        if (!empty($options['limit'])) {
139
-            $query->take($options['limit']);
138
+        if (!empty($options[ 'limit' ])) {
139
+            $query->take($options[ 'limit' ]);
140 140
         }
141 141
     }
142 142
 
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function queryOrderBy(Builder $query, array $options)
150 150
     {
151
-        if (!empty($options['sort']) && \array_key_exists($options['sort'], static::$sortingOptions)) {
152
-            if ($options['sort'] === 'random') {
151
+        if (!empty($options[ 'sort' ]) && \array_key_exists($options[ 'sort' ], static::$sortingOptions)) {
152
+            if ($options[ 'sort' ] === 'random') {
153 153
                 $query->inRandomOrder();
154 154
             } else {
155
-                list($sortField, $sortDirection) = explode(' ', $options['sort']);
155
+                list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]);
156 156
 
157 157
                 $query->orderBy($sortField, $sortDirection);
158 158
             }
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
      */
168 168
     protected function withRelation(Builder $query, array $options)
169 169
     {
170
-        if (!empty($options['fetchPosts'])) {
170
+        if (!empty($options[ 'fetchPosts' ])) {
171 171
             $query->with(
172 172
                 [
173
-                    'posts' => static function (HasMany $query) use ($options) {
173
+                    'posts' => static function(HasMany $query) use ($options) {
174 174
                         $query->isPublished();
175 175
 
176 176
                         self::handleExceptions($query->getQuery(), $options);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
         $query->withCount(
183 183
             [
184
-                'posts' => static function ($query) use ($options) {
184
+                'posts' => static function($query) use ($options) {
185 185
                     $query->isPublished();
186 186
 
187 187
                     self::handleExceptions($query, $options);
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
      */
205 205
     protected static function handleExceptions(Builder $query, array $options)
206 206
     {
207
-        if (!empty($options['exceptPosts'])) {
208
-            PostListExceptionsTrait::handleExceptionsByPost($query, $options['exceptPosts']);
207
+        if (!empty($options[ 'exceptPosts' ])) {
208
+            PostListExceptionsTrait::handleExceptionsByPost($query, $options[ 'exceptPosts' ]);
209 209
         }
210 210
 
211
-        if (!empty($options['exceptCategories'])) {
212
-            PostListExceptionsTrait::handleExceptionsByCategory($query, $options['exceptCategories']);
211
+        if (!empty($options[ 'exceptCategories' ])) {
212
+            PostListExceptionsTrait::handleExceptionsByCategory($query, $options[ 'exceptCategories' ]);
213 213
         }
214 214
     }
215 215
 }
Please login to merge, or discard this patch.
updates/change_description_field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function up()
20 20
     {
21 21
         if (Schema::hasTable(Series::TABLE_NAME)) {
22
-            Schema::table(Series::TABLE_NAME, static function ($table) {
22
+            Schema::table(Series::TABLE_NAME, static function($table) {
23 23
                 $table->text('description')->nullable()->change();
24 24
             });
25 25
         }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function down()
32 32
     {
33 33
         if (Schema::hasTable(Series::TABLE_NAME)) {
34
-            Schema::table(Series::TABLE_NAME, static function ($table) {
34
+            Schema::table(Series::TABLE_NAME, static function($table) {
35 35
                 $table->string('description')->nullable()->change();
36 36
             });
37 37
         }
Please login to merge, or discard this patch.
updates/create_taxonomies_tables.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@  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
             $table->dropColumn(Series::TABLE_NAME . '_id');
59 59
         });
60 60
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         if (!Schema::hasTable(Tag::TABLE_NAME)) {
70 70
             Schema::create(
71 71
                 Tag::TABLE_NAME,
72
-                static function ($table) {
72
+                static function($table) {
73 73
                     $table->engine = 'InnoDB';
74 74
 
75 75
                     $table->increments('id');
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
         if (!Schema::hasTable(Tag::CROSS_REFERENCE_TABLE_NAME)) {
84 84
             Schema::create(
85 85
                 Tag::CROSS_REFERENCE_TABLE_NAME,
86
-                static function ($table) {
86
+                static function($table) {
87 87
                     $table->engine = 'InnoDB';
88 88
 
89 89
                     $table->integer('tag_id')->unsigned()->nullable()->default(null);
90 90
                     $table->integer('post_id')->unsigned()->nullable()->default(null);
91
-                    $table->index(['tag_id', 'post_id']);
91
+                    $table->index([ 'tag_id', 'post_id' ]);
92 92
                     $table->foreign('tag_id')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade');
93 93
                     $table->foreign('post_id')->references('id')->on('rainlab_blog_posts')->onDelete('cascade');
94 94
                 }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         if (!Schema::hasTable(Series::TABLE_NAME)) {
105 105
             Schema::create(
106 106
                 Series::TABLE_NAME,
107
-                static function ($table) {
107
+                static function($table) {
108 108
                     $table->engine = 'InnoDB';
109 109
 
110 110
                     $table->increments('id');
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                 }
116 116
             );
117 117
 
118
-            Schema::table('rainlab_blog_posts', function ($table) {
118
+            Schema::table('rainlab_blog_posts', function($table) {
119 119
                 $table->integer(Series::TABLE_NAME . '_id')->unsigned()->nullable()->default(null);
120 120
                 $table->foreign(Series::TABLE_NAME . '_id')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade');
121 121
             });
Please login to merge, or discard this patch.