Completed
Push — master ( 152837...3e919c )
by Gino
02:18
created
models/PostsRelationScopeTrait.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @return mixed
22 22
      */
23
-    public function scopeListFrontend(Builder $query, array $options = [])
23
+    public function scopeListFrontend(Builder $query, array $options = [ ])
24 24
     {
25 25
         $this->withRelation($query);
26 26
 
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
      */
44 44
     private function queryDisplayEmpty(Builder $query, array $options)
45 45
     {
46
-        if (empty($options['displayEmpty'])) {
46
+        if (empty($options[ 'displayEmpty' ])) {
47 47
             $query->withCount(
48 48
                 [
49
-                    'posts' => function ($query) {
49
+                    'posts' => function($query) {
50 50
                         $query->isPublished();
51 51
                     }
52 52
                 ]
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
      */
63 63
     private function queryPostSlug(Builder $query, array $options)
64 64
     {
65
-        if (!empty($options['post'])) {
65
+        if (!empty($options[ 'post' ])) {
66 66
             $query->whereHas(
67 67
                 'posts',
68
-                function ($query) use ($options) {
69
-                    $query->whereSlug($options['post']);
68
+                function($query) use ($options) {
69
+                    $query->whereSlug($options[ 'post' ]);
70 70
                 }
71 71
             );
72 72
         }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function queryLimit(Builder $query, array $options)
82 82
     {
83
-        if (!empty($options['limit'])) {
84
-            $query->take($options['limit']);
83
+        if (!empty($options[ 'limit' ])) {
84
+            $query->take($options[ 'limit' ]);
85 85
         }
86 86
     }
87 87
 
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
      */
94 94
     private function queryOrderBy(Builder $query, array $options)
95 95
     {
96
-        if (in_array($options['sort'], array_keys(self::$sortingOptions))) {
97
-            if ($options['sort'] == 'random') {
96
+        if (in_array($options[ 'sort' ], array_keys(self::$sortingOptions))) {
97
+            if ($options[ 'sort' ] == 'random') {
98 98
                 $query->inRandomOrder();
99 99
             } else {
100
-                list($sortField, $sortDirection) = explode(' ', $options['sort']);
100
+                list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]);
101 101
 
102 102
                 if ($sortField == 'posts_count') {
103 103
                     $query->withCount(
104 104
                         [
105
-                            'posts' => function ($query) {
105
+                            'posts' => function($query) {
106 106
                                 $query->isPublished();
107 107
                             }
108 108
                         ]
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $query->with(
125 125
             [
126
-                'posts' => function ($query) {
126
+                'posts' => function($query) {
127 127
                     $query->isPublished();
128 128
                 }
129 129
             ]
Please login to merge, or discard this patch.