Completed
Push — master ( 86ce89...cd8f65 )
by Sherif
03:43
created
Modules/V1/Notifications/Repositories/PushNotificationDeviceRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         
33 33
         if (array_key_exists('ios', $devicesArray)) 
34 34
         {
35
-            $message = $this->constructMessage($messageText, [ 'badge' => 15, 'sound' => 'default', 'content-available' => 1 ]);
35
+            $message = $this->constructMessage($messageText, ['badge' => 15, 'sound' => 'default', 'content-available' => 1]);
36 36
             $iosDevices = \PushNotification::DeviceCollection($devicesArray['ios']);
37 37
             $this->push('ios', $iosDevices, $message);
38 38
         }
Please login to merge, or discard this patch.
src/Modules/V1/Reporting/Report.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Illuminate\Database\Eloquent\Model;
4 4
 use Illuminate\Database\Eloquent\SoftDeletes;
5 5
 
6
-class Report extends Model{
6
+class Report extends Model {
7 7
 
8 8
     use SoftDeletes;
9 9
 	protected $table    = 'reports';
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	protected $hidden   = ['deleted_at'];
12 12
 	protected $guarded  = ['id'];
13 13
 	protected $fillable = ['report_name', 'view_name'];
14
-    public $searchable  = ['report_name', 'view_name'];
14
+    public $searchable = ['report_name', 'view_name'];
15 15
 
16 16
 	public function getCreatedAtAttribute($value)
17 17
     {
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Http/Controllers/UsersController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      * to preform actions like (add, edit ... etc).
13 13
      * @var string
14 14
      */
15
-    protected $model               = 'users';
15
+    protected $model = 'users';
16 16
 
17 17
     /**
18 18
      * List of all route actions that the base api controller
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
      * will skip login check for them.
27 27
      * @var array
28 28
      */
29
-    protected $skipLoginCheck      = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken'];
29
+    protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken'];
30 30
 
31 31
     /**
32 32
      * The validations rules used by the base api controller
33 33
      * to check before add.
34 34
      * @var array
35 35
      */
36
-    protected $validationRules     = [
36
+    protected $validationRules = [
37 37
     'email'    => 'required|email|unique:users,email,{id}',
38 38
     'password' => 'min:6'
39 39
     ];
Please login to merge, or discard this patch.
src/Modules/V1/Reporting/Http/Controllers/ReportsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      * to preform actions like (add, edit ... etc).
13 13
      * @var string
14 14
      */
15
-    protected $model               = 'reports';
15
+    protected $model = 'reports';
16 16
 
17 17
     /**
18 18
      * List of all route actions that the base api controller
Please login to merge, or discard this patch.
src/Modules/V1/Core/AbstractRepositories/AbstractRepository.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
         /**
64 64
          * Construct the select conditions for the model.
65 65
          */
66
-        $model->where(function ($q) use ($query, $conditionColumns, $relations){
66
+        $model->where(function($q) use ($query, $conditionColumns, $relations){
67 67
 
68 68
             if (count($conditionColumns)) 
69 69
             {
70 70
                 /**
71 71
                  * Use the first element in the model columns to construct the first condition.
72 72
                  */
73
-                $q->where(\DB::raw('LOWER(' . array_shift($conditionColumns) . ')'), 'LIKE', '%' . strtolower($query) . '%');
73
+                $q->where(\DB::raw('LOWER('.array_shift($conditionColumns).')'), 'LIKE', '%'.strtolower($query).'%');
74 74
             }
75 75
 
76 76
             /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
              */
79 79
             foreach ($conditionColumns as $column) 
80 80
             {
81
-                $q->orWhere(\DB::raw('LOWER(' . $column . ')'), 'LIKE', '%' . strtolower($query) . '%');
81
+                $q->orWhere(\DB::raw('LOWER('.$column.')'), 'LIKE', '%'.strtolower($query).'%');
82 82
             }
83 83
 
84 84
             /**
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
                     /**
100 100
                      * Construct the relation condition.
101 101
                      */
102
-                    $q->orWhereHas($relation, function ($subModel) use ($query, $relation){
102
+                    $q->orWhereHas($relation, function($subModel) use ($query, $relation){
103 103
 
104
-                        $subModel->where(function ($q) use ($query, $relation){
104
+                        $subModel->where(function($q) use ($query, $relation){
105 105
 
106 106
                             /**
107 107
                              * Get columns of the relation.
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                                 /**
114 114
                                 * Use the first element in the relation model columns to construct the first condition.
115 115
                                  */
116
-                                $q->where(\DB::raw('LOWER(' . array_shift($subConditionColumns) . ')'), 'LIKE', '%' . strtolower($query) . '%');
116
+                                $q->where(\DB::raw('LOWER('.array_shift($subConditionColumns).')'), 'LIKE', '%'.strtolower($query).'%');
117 117
                             }
118 118
 
119 119
                             /**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                              */
122 122
                             foreach ($subConditionColumns as $subConditionColumn)
123 123
                             {
124
-                                $q->orWhere(\DB::raw('LOWER(' . $subConditionColumn . ')'), 'LIKE', '%' . strtolower($query) . '%');
124
+                                $q->orWhere(\DB::raw('LOWER('.$subConditionColumn.')'), 'LIKE', '%'.strtolower($query).'%');
125 125
                             } 
126 126
                         });
127 127
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         $modelClass = $this->model;
183 183
         $relations  = [];
184 184
 
185
-        \DB::transaction(function () use (&$model, &$relations, $data, $saveLog, $modelClass) {
185
+        \DB::transaction(function() use (&$model, &$relations, $data, $saveLog, $modelClass) {
186 186
             /**
187 187
              * If the id is present in the data then select the model for updating,
188 188
              * else create new model.
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             $model = array_key_exists('id', $data) ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass;
192 192
             if ( ! $model) 
193 193
             {
194
-                \ErrorHandler::notFound(class_basename($modelClass) . ' with id : ' . $data['id']);
194
+                \ErrorHandler::notFound(class_basename($modelClass).' with id : '.$data['id']);
195 195
             }
196 196
 
197 197
             /**
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                                  */
251 251
                                 if ( ! $relationModel) 
252 252
                                 {
253
-                                    \ErrorHandler::notFound(class_basename($relationBaseModel) . ' with id : ' . $val['id']);
253
+                                    \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$val['id']);
254 254
                                 }
255 255
 
256 256
                                 /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                                     /**
262 262
                                      * Prevent the sub relations or attributes not in the fillable.
263 263
                                      */
264
-                                    if (gettype($val) !== 'object' && gettype($val) !== 'array' &&  array_search($attr, $relationModel->getFillable(), true) !== false)
264
+                                    if (gettype($val) !== 'object' && gettype($val) !== 'array' && array_search($attr, $relationModel->getFillable(), true) !== false)
265 265
                                     {
266 266
                                         $relationModel->$attr = $val;
267 267
                                     }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                                      */
290 290
                                     if ( ! $relationModel) 
291 291
                                     {
292
-                                        \ErrorHandler::notFound(class_basename($relationBaseModel) . ' with id : ' . $value['id']);
292
+                                        \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$value['id']);
293 293
                                     }
294 294
 
295 295
                                     /**
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
         }
429 429
         else
430 430
         {
431
-            call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) use ($data, $saveLog){
431
+            call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function($model) use ($data, $saveLog){
432 432
                 $model->update($data);
433 433
                 $saveLog ? \Logging::saveLog('update', class_basename($this->model), $this->getModel(), $model->id, $model) : false;
434 434
             });
@@ -447,11 +447,11 @@  discard block
 block discarded – undo
447 447
     {
448 448
         if ($attribute == 'id') 
449 449
         {
450
-            \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) {
450
+            \DB::transaction(function() use ($value, $attribute, &$result, $saveLog) {
451 451
                 $model = $this->model->lockForUpdate()->find($value);
452 452
                 if ( ! $model) 
453 453
                 {
454
-                    \ErrorHandler::notFound(class_basename($this->model) . ' with id : ' . $value);
454
+                    \ErrorHandler::notFound(class_basename($this->model).' with id : '.$value);
455 455
                 }
456 456
                 
457 457
                 $model->delete();
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
         }
461 461
         else
462 462
         {
463
-            \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) {
464
-                call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model){
463
+            \DB::transaction(function() use ($value, $attribute, &$result, $saveLog) {
464
+                call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function($model) {
465 465
                     $model->delete();
466 466
                     $saveLog ? \Logging::saveLog('delete', class_basename($this->model), $this->getModel(), $model->id, $model) : false;
467 467
                 });
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     {
499 499
         $conditions = $this->constructConditions($conditions);
500 500
         $sort       = $desc ? 'desc' : 'asc';
501
-        return call_user_func_array("{$this->getModel()}::with",  array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->orderBy($sortBy, $sort)->get($columns);
501
+        return call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->orderBy($sortBy, $sort)->get($columns);
502 502
     }
503 503
 
504 504
     /**
@@ -529,12 +529,12 @@  discard block
 block discarded – undo
529 529
         {
530 530
             if ($key == 'and') 
531 531
             {
532
-                $conditionString  .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']) . ' {op} ';
532
+                $conditionString  .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']).' {op} ';
533 533
                 $conditionValues   = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']);
534 534
             }
535 535
             else if ($key == 'or')
536 536
             {
537
-                $conditionString  .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']) . ' {op} ';
537
+                $conditionString  .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']).' {op} ';
538 538
                 $conditionValues   = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']);
539 539
             }
540 540
             else
@@ -559,20 +559,20 @@  discard block
 block discarded – undo
559 559
                 
560 560
                 if (strtolower($operator) == 'between') 
561 561
                 {
562
-                    $conditionString  .= $key . '>=? and ';
562
+                    $conditionString  .= $key.'>=? and ';
563 563
                     $conditionValues[] = $value1;
564 564
 
565
-                    $conditionString  .= $key . '<=? {op} ';
565
+                    $conditionString  .= $key.'<=? {op} ';
566 566
                     $conditionValues[] = $value2;
567 567
                 }
568 568
                 else
569 569
                 {
570
-                    $conditionString  .= $key . $operator . '? {op} ';
570
+                    $conditionString  .= $key.$operator.'? {op} ';
571 571
                     $conditionValues[] = $value;
572 572
                 }
573 573
             }
574 574
         }
575
-        $conditionString = '(' . rtrim($conditionString, '{op} ') . ')';
575
+        $conditionString = '('.rtrim($conditionString, '{op} ').')';
576 576
         return ['conditionString' => $conditionString, 'conditionValues' => $conditionValues];
577 577
     }
578 578
 
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Repositories/UserRepository.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param  boolean $user
24 24
      * @return boolean
25 25
      */
26
-    public function can($nameOfPermission, $model, $user = false )
26
+    public function can($nameOfPermission, $model, $user = false)
27 27
     {      
28 28
         $user        = $user ?: \JWTAuth::parseToken()->authenticate();
29 29
         $permissions = [];
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             \ErrorHandler::tokenExpired();
34 34
         }
35 35
 
36
-        $user->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){
36
+        $user->groups->lists('permissions')->each(function($permission) use (&$permissions, $model){
37 37
             $permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); 
38 38
         });
39 39
         
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function assignGroups($user_id, $group_ids)
63 63
     {
64
-        \DB::transaction(function () use ($user_id, $group_ids) {
64
+        \DB::transaction(function() use ($user_id, $group_ids) {
65 65
             $user = $this->find($user_id);
66 66
             $user->groups()->detach();
67 67
             $user->groups()->attach($group_ids);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $view->with(['url' => $url]);
222 222
         });
223 223
 
224
-        $response = \Password::sendResetLink($email, function (\Illuminate\Mail\Message $message) {
224
+        $response = \Password::sendResetLink($email, function(\Illuminate\Mail\Message $message) {
225 225
             $message->subject('Your Password Reset Link');
226 226
         });
227 227
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     public function resetPassword($credentials)
242 242
     {
243 243
         $token    = false;
244
-        $response = \Password::reset($credentials, function ($user, $password) use (&$token) {
244
+        $response = \Password::reset($credentials, function($user, $password) use (&$token) {
245 245
             $user->password = bcrypt($password);
246 246
             $user->save();
247 247
 
Please login to merge, or discard this patch.