Passed
Push — master ( 7057c8...c1bd78 )
by Jesús
01:56
created
src/EloquentRepository.php 1 patch
Braces   +37 added lines, -15 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
         $this->eagerLoadRelations();
46 46
         $this->applyCriteria();
47 47
         
48
-        if ( !is_null( $value ) ) $this->model = $this->model->where( $field, $value );
48
+        if ( !is_null( $value ) ) {
49
+            $this->model = $this->model->where( $field, $value );
50
+        }
49 51
         
50 52
         $result = $this->model->first( $columns );
51 53
         
@@ -65,7 +67,9 @@  discard block
 block discarded – undo
65 67
         $this->eagerLoadRelations();
66 68
         $this->applyCriteria();
67 69
         
68
-        if ( !is_null( $value ) && !is_null( $field ) ) $this->model = $this->model->where( $field, $value );
70
+        if ( !is_null( $value ) && !is_null( $field ) ) {
71
+            $this->model = $this->model->where( $field, $value );
72
+        }
69 73
         
70 74
         $result = $this->model->get( $columns );
71 75
         
@@ -111,7 +115,9 @@  discard block
 block discarded – undo
111 115
      */
112 116
     public function with( $relations )
113 117
     {
114
-        if ( is_string( $relations ) ) $relations = func_get_args();
118
+        if ( is_string( $relations ) ) {
119
+            $relations = func_get_args();
120
+        }
115 121
         
116 122
         $this->with = $relations;
117 123
         
@@ -204,7 +210,9 @@  discard block
 block discarded – undo
204 210
             // Single update.
205 211
             $this->model->where( $field, $value)->update( $cleanFields );
206 212
             
207
-            foreach( $cleanFields as $F => $V ) $this->model->{$F} = $V;
213
+            foreach( $cleanFields as $F => $V ) {
214
+                $this->model->{$F} = $V;
215
+            }
208 216
             
209 217
             $returnedVal = $this->model;
210 218
         } else
@@ -229,11 +237,15 @@  discard block
 block discarded – undo
229 237
     {
230 238
         $this->applyCriteria();
231 239
         
232
-        if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->delete();
233
-        else
240
+        if ( !is_null( $value ) ) {
241
+            $result = $this->model->where( $field, $value )->delete();
242
+        } else
234 243
         {
235
-            if ( !empty( $this->criteria ) ) $result = $this->model->delete();
236
-            else $result = FALSE;
244
+            if ( !empty( $this->criteria ) ) {
245
+                $result = $this->model->delete();
246
+            } else {
247
+                $result = FALSE;
248
+            }
237 249
         }
238 250
         
239 251
         $this->resetScope();
@@ -274,11 +286,15 @@  discard block
 block discarded – undo
274 286
     {
275 287
         $this->applyCriteria();
276 288
         
277
-        if ( !is_null( $value ) ) $result = $this->model->where( $field, $value )->forceDelete();
278
-        else
289
+        if ( !is_null( $value ) ) {
290
+            $result = $this->model->where( $field, $value )->forceDelete();
291
+        } else
279 292
         {
280
-            if ( !empty( $this->criteria ) ) $result = $this->model->forceDelete();
281
-            else $result = FALSE;
293
+            if ( !empty( $this->criteria ) ) {
294
+                $result = $this->model->forceDelete();
295
+            } else {
296
+                $result = FALSE;
297
+            }
282 298
         }
283 299
         
284 300
         $this->resetScope();
@@ -296,7 +312,9 @@  discard block
 block discarded – undo
296 312
      */
297 313
     protected function eagerLoadRelations()
298 314
     {
299
-        if ( is_array( $this->with ) ) $this->model->with( $this->with );
315
+        if ( is_array( $this->with ) ) {
316
+            $this->model->with( $this->with );
317
+        }
300 318
     }
301 319
     
302 320
     
@@ -310,7 +328,9 @@  discard block
 block discarded – undo
310 328
         
311 329
         foreach( $data as $key => $value )
312 330
         {
313
-            if ( !in_array( $key, $fillableFields ) ) unset( $data[ $key ] );
331
+            if ( !in_array( $key, $fillableFields ) ) {
332
+                unset( $data[ $key ] );
333
+            }
314 334
         }
315 335
         
316 336
         return $data;
@@ -325,7 +345,9 @@  discard block
 block discarded – undo
325 345
         {
326 346
             foreach( $this->criteria as $criteria )
327 347
             {
328
-                if( $criteria instanceof CriteriaInterface ) $this->model = $criteria->apply( $this->model, $this );
348
+                if( $criteria instanceof CriteriaInterface ) {
349
+                    $this->model = $criteria->apply( $this->model, $this );
350
+                }
329 351
             }
330 352
         }
331 353
         
Please login to merge, or discard this patch.