Passed
Push — analysis-XNGW1g ( 55039c )
by Kyle
07:59 queued 32s
created
app/Services/CrudService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@
 block discarded – undo
29 29
         return $this->repository->delete($id);
30 30
     }
31 31
 
32
-    public function getPaginate(int $perPage = null, bool $orderBy = true, array $column = ['*'])
32
+    public function getPaginate(int $perPage = null, bool $orderBy = true, array $column = [ '*' ])
33 33
     {
34 34
         return $this->repository->getPaginate($perPage, $orderBy, $column);
35 35
     }
36 36
 
37
-    public function getPaginateWithFilter(array $filters = [], int $perPage = null, bool $orderBy = true, array $column = ['*'])
37
+    public function getPaginateWithFilter(array $filters = [ ], int $perPage = null, bool $orderBy = true, array $column = [ '*' ])
38 38
     {
39 39
         return $this->repository->getPaginateWithFilter($filters, $perPage, $orderBy, $column);
40 40
     }
41 41
 
42
-    public function getAllWithFilter(array $filters = [], bool $orderBy = true, array $column = ['*'])
42
+    public function getAllWithFilter(array $filters = [ ], bool $orderBy = true, array $column = [ '*' ])
43 43
     {
44 44
         return $this->repository->getAllWithFilter($filters, $orderBy, $column);
45 45
     }
Please login to merge, or discard this patch.
app/Repositories/Eloquent/BaseEloquentRepository.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @return mixed
32 32
      */
33
-    public function find($id, array $relationships = [])
33
+    public function find($id, array $relationships = [ ])
34 34
     {
35 35
         $result = $this->model->with($relationships)->find($id);
36 36
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      *
98 98
      * @return mixed
99 99
      */
100
-    public function getPaginate(int $perPage = null, bool $orderBy = true, array $column = ['*'])
100
+    public function getPaginate(int $perPage = null, bool $orderBy = true, array $column = [ '*' ])
101 101
     {
102 102
         $query = $this->model;
103 103
         if (!empty($column)) {
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
      * @return mixed
140 140
      */
141 141
     public function getPaginateWithFilter(
142
-        array $filters = [],
142
+        array $filters = [ ],
143 143
         int $perPage = null,
144 144
         bool $orderBy = true,
145
-        array $column = ['*']
145
+        array $column = [ '*' ]
146 146
     ) {
147 147
         $query = $this->processFilter($filters, $orderBy, $column);
148 148
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      *
159 159
      * @return mixed
160 160
      */
161
-    public function getAllWithFilter(array $filters = [], bool $orderBy = true, array $column = ['*'])
161
+    public function getAllWithFilter(array $filters = [ ], bool $orderBy = true, array $column = [ '*' ])
162 162
     {
163 163
         $query = $this->processFilter($filters, $orderBy, $column);
164 164
 
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
      *
175 175
      * @return \Illuminate\Database\Eloquent\Model|mixed
176 176
      */
177
-    protected function processFilter(array $filters = [], bool $orderBy = true, array $column = ['*'])
177
+    protected function processFilter(array $filters = [ ], bool $orderBy = true, array $column = [ '*' ])
178 178
     {
179 179
         $query = $this->model;
180 180
         if (!empty($column)) {
181 181
             $query = $query->select($column);
182 182
         }
183 183
 
184
-        if (@$filters['conditions'] && count($filters['conditions'])) {
184
+        if (@$filters[ 'conditions' ] && count($filters[ 'conditions' ])) {
185 185
             $query = $this->loopCondition($filters, $query);
186 186
         }
187 187
         if ($orderBy) {
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function loopCondition($filters, $query)
203 203
     {
204
-        foreach ($filters['conditions'] as $columnName => $condition) {
205
-            $columnValue = isset($filters['options'][$columnName]) && !is_null($filters['options'][$columnName])
206
-                ? $filters['options'][$columnName] : null;
204
+        foreach ($filters[ 'conditions' ] as $columnName => $condition) {
205
+            $columnValue = isset($filters[ 'options' ][ $columnName ]) && !is_null($filters[ 'options' ][ $columnName ])
206
+                ? $filters[ 'options' ][ $columnName ] : null;
207 207
             if (!is_null($columnValue)) {
208 208
                 switch ($condition) {
209 209
                     case 'like':
Please login to merge, or discard this patch.