Completed
Push — master ( fb73c0...e952da )
by Sherif
07:01
created
V1/Notifications/Http/Controllers/PushNotificationsDevicesController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
      * to preform actions like (add, edit ... etc).
13 13
      * @var string
14 14
      */
15
-    protected $model            = 'pushNotificationDevices';
15
+    protected $model = 'pushNotificationDevices';
16 16
 
17 17
     /**
18 18
      * The validations rules used by the base api controller
19 19
      * to check before add.
20 20
      * @var array
21 21
      */
22
-    protected $validationRules  = [
22
+    protected $validationRules = [
23 23
     'device_token' => 'required|string|max:255',
24 24
     'device_type'  => 'required|in:android,ios',
25 25
     'user_id'      => 'required|exists:users,id',
Please login to merge, or discard this patch.
Database/Migrations/2016_01_24_111942_push_notifications_devices.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-		Schema::create('push_notifications_devices', function (Blueprint $table) {
15
+		Schema::create('push_notifications_devices', function(Blueprint $table) {
16 16
 			$table->increments('id');
17
-			$table->string('device_token',255);
17
+			$table->string('device_token', 255);
18 18
 			$table->enum('device_type', ['android', 'ios']);
19 19
 			$table->integer('user_id');
20 20
 			$table->boolean('active')->default(1);
Please login to merge, or discard this patch.
Database/Migrations/2016_01_24_123631_initialize_notifications.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
 	 */
165 165
 	public function down()
166 166
 	{
167
-		$permissions  = DB::table('permissions')->whereIn('model', ['notifications', 'pushNotificationDevices']);
167
+		$permissions = DB::table('permissions')->whereIn('model', ['notifications', 'pushNotificationDevices']);
168 168
 		DB::table('groups_permissions')->whereIn('permission_id', $permissions->lists('id'))->delete();
169 169
 		$permissions->delete();
170 170
 	}
Please login to merge, or discard this patch.
src/Modules/V1/Notifications/PushNotificationDevice.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 use Illuminate\Database\Eloquent\Model;
4 4
 use Illuminate\Database\Eloquent\SoftDeletes;
5 5
 
6
-class PushNotificationDevice extends Model{
6
+class PushNotificationDevice extends Model {
7 7
 
8 8
     use SoftDeletes;
9 9
     protected $table    = 'push_notifications_devices';
Please login to merge, or discard this patch.
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.