Completed
Push — master ( b81254...51291a )
by Gino
02:08
created
models/ModelAbstract.php 1 patch
Spacing   +16 added lines, -16 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);
59 59
 
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
      */
99 99
     private function queryDisplayEmpty(Builder $query, array $options)
100 100
     {
101
-        if (empty($options['displayEmpty'])) {
101
+        if (empty($options[ 'displayEmpty' ])) {
102 102
             $query->withCount(
103 103
                 [
104
-                    'posts' => function ($query) {
104
+                    'posts' => function($query) {
105 105
                         $query->isPublished();
106 106
                     }
107 107
                 ]
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
             $connectionConfig = $query->getConnection()->getConfig();
111 111
 
112 112
             // GROUP BY is required for SQLite-based installations
113
-            if (!empty($connectionConfig['name']) &&
114
-                strtolower($connectionConfig['name']) === self::CONNECTION_SQLITE
113
+            if (!empty($connectionConfig[ 'name' ]) &&
114
+                strtolower($connectionConfig[ 'name' ]) === self::CONNECTION_SQLITE
115 115
             ) {
116 116
                 $query->groupBy('id');
117 117
             }
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
      */
127 127
     private function queryPostSlug(Builder $query, array $options)
128 128
     {
129
-        if (!empty($options['post'])) {
129
+        if (!empty($options[ 'post' ])) {
130 130
             $query->whereHas(
131 131
                 'posts',
132
-                function ($query) use ($options) {
133
-                    ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']);
132
+                function($query) use ($options) {
133
+                    ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]);
134 134
                 }
135 135
             );
136 136
         }
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
      */
145 145
     private function queryLimit(Builder $query, array $options)
146 146
     {
147
-        if (!empty($options['limit'])) {
148
-            $query->take($options['limit']);
147
+        if (!empty($options[ 'limit' ])) {
148
+            $query->take($options[ 'limit' ]);
149 149
         }
150 150
     }
151 151
 
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
      */
158 158
     private function queryOrderBy(Builder $query, array $options)
159 159
     {
160
-        if (\array_key_exists($options['sort'], static::$sortingOptions)) {
161
-            if ($options['sort'] === 'random') {
160
+        if (\array_key_exists($options[ 'sort' ], static::$sortingOptions)) {
161
+            if ($options[ 'sort' ] === 'random') {
162 162
                 $query->inRandomOrder();
163 163
             } else {
164
-                list($sortField, $sortDirection) = explode(' ', $options['sort']);
164
+                list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]);
165 165
 
166 166
                 if ($sortField === 'posts_count') {
167 167
                     $query->withCount(
168 168
                         [
169
-                            'posts' => function ($query) {
169
+                            'posts' => function($query) {
170 170
                                 $query->isPublished();
171 171
                             }
172 172
                         ]
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     {
188 188
         $query->with(
189 189
             [
190
-                'posts' => function ($query) {
190
+                'posts' => function($query) {
191 191
                     $query->isPublished();
192 192
                 }
193 193
             ]
Please login to merge, or discard this patch.