Completed
Push — master ( 0208a8...03841e )
by Sherif
02:49
created
src/Modules/Acl/AclGroup.php 1 patch
Spacing   +3 added lines, -3 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 AclGroup extends Model{
6
+class AclGroup extends Model {
7 7
 
8 8
     use SoftDeletes;
9 9
     protected $table    = 'groups';
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function users()
31 31
     {
32
-        return $this->belongsToMany('\App\Modules\Acl\AclUser','users_groups','group_id','user_id')->whereNull('users_groups.deleted_at')->withTimestamps();
32
+        return $this->belongsToMany('\App\Modules\Acl\AclUser', 'users_groups', 'group_id', 'user_id')->whereNull('users_groups.deleted_at')->withTimestamps();
33 33
     }
34 34
 
35 35
     public function permissions()
36 36
     {
37
-        return $this->belongsToMany('\App\Modules\Acl\AclPermission','groups_permissions','group_id','permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
37
+        return $this->belongsToMany('\App\Modules\Acl\AclPermission', 'groups_permissions', 'group_id', 'permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
38 38
     }
39 39
 
40 40
     public static function boot()
Please login to merge, or discard this patch.
src/Modules/Acl/Database/Migrations/2015_12_20_124153_users.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-		Schema::create('users', function (Blueprint $table) {
15
+		Schema::create('users', function(Blueprint $table) {
16 16
             $table->increments('id');
17
-            $table->string('first_name',100)->nullable();
18
-            $table->string('last_name',100)->nullable();
19
-            $table->string('user_name',100)->nullable();
17
+            $table->string('first_name', 100)->nullable();
18
+            $table->string('last_name', 100)->nullable();
19
+            $table->string('user_name', 100)->nullable();
20 20
             $table->text('address')->nullable();
21 21
             $table->string('email')->unique();
22 22
             $table->string('password', 60);
Please login to merge, or discard this patch.
src/Modules/Acl/Database/Migrations/2016_01_05_130506_permissions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-        Schema::create('permissions', function (Blueprint $table) {
15
+        Schema::create('permissions', function(Blueprint $table) {
16 16
             $table->increments('id');
17
-            $table->string('name',100);
18
-            $table->string('model',100);
17
+            $table->string('name', 100);
18
+            $table->string('model', 100);
19 19
             $table->softDeletes();
20 20
             $table->timestamps();
21 21
             $table->unique(array('name', 'model'));
22 22
         });
23
-        Schema::create('groups_permissions', function (Blueprint $table) {
23
+        Schema::create('groups_permissions', function(Blueprint $table) {
24 24
             $table->increments('id');
25 25
             $table->integer('group_id');
26 26
             $table->integer('permission_id');
Please login to merge, or discard this patch.
src/Modules/Acl/Database/Migrations/2015_12_22_145819_groups.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-		Schema::create('groups', function (Blueprint $table) {
15
+		Schema::create('groups', function(Blueprint $table) {
16 16
             $table->increments('id');
17
-            $table->string('name',100)->unique();
17
+            $table->string('name', 100)->unique();
18 18
             $table->softDeletes();
19 19
             $table->timestamps();
20 20
         });
21 21
         
22
-        Schema::create('users_groups', function (Blueprint $table) {
22
+        Schema::create('users_groups', function(Blueprint $table) {
23 23
             $table->increments('id');
24 24
             $table->integer('user_id');
25 25
             $table->integer('group_id');
Please login to merge, or discard this patch.
src/Modules/Acl/AclPermission.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     
30 30
     public function groups()
31 31
     {
32
-        return $this->belongsToMany('\App\Modules\Acl\AclGroup','groups_permissions','permission_id','group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
32
+        return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'groups_permissions', 'permission_id', 'group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
33 33
     }
34 34
 
35 35
     public static function boot()
Please login to merge, or discard this patch.
src/Modules/Acl/AclUser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     use SoftDeletes;
10 10
     protected $table    = 'users';
11 11
     protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
-    protected $hidden   = ['password', 'remember_token','deleted_at'];
12
+    protected $hidden   = ['password', 'remember_token', 'deleted_at'];
13 13
     protected $guarded  = ['id'];
14 14
     protected $fillable = ['first_name', 'last_name', 'user_name', 'address', 'email', 'password'];
15 15
     protected $appends  = ['permissions'];
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function groups()
49 49
     {
50
-        return $this->belongsToMany('\App\Modules\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps();
50
+        return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps();
51 51
     }
52 52
 
53 53
     public function getPermissionsAttribute()
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $permissions = [];
56 56
         foreach ($this->groups as $group)
57 57
         {
58
-            $group->permissions->each(function ($permission) use (&$permissions){
58
+            $group->permissions->each(function($permission) use (&$permissions){
59 59
                 $permissions[$permission->model][$permission->id] = $permission->name;
60 60
             });
61 61
         }
Please login to merge, or discard this patch.
src/Modules/Core/Settings.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@
 block discarded – undo
3 3
 use Illuminate\Database\Eloquent\Model;
4 4
 use Illuminate\Database\Eloquent\SoftDeletes;
5 5
 
6
-class Settings extends Model{
6
+class Settings extends Model {
7 7
 
8 8
     use SoftDeletes;
9 9
     protected $table    = 'settings';
10 10
     protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11 11
     protected $hidden   = ['deleted_at'];
12 12
     protected $guarded  = ['id', 'key'];
13
-    protected $fillable = ['name','value'];
13
+    protected $fillable = ['name', 'value'];
14 14
     
15 15
     public function getCreatedAtAttribute($value)
16 16
     {
Please login to merge, or discard this patch.
src/Modules/Core/AbstractRepositories/AbstractRepository.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -79,26 +79,26 @@  discard block
 block discarded – undo
79 79
         $conditionColumns = $this->model->getFillable();
80 80
         $sort             = $desc ? 'desc' : 'asc';
81 81
 
82
-        $model->where(function ($q) use ($query, $conditionColumns, $relations){
83
-            $q->where(\DB::raw('LOWER(CAST(' . array_shift($conditionColumns) . ' AS TEXT))'), 'LIKE', '%' . strtolower($query) . '%');
82
+        $model->where(function($q) use ($query, $conditionColumns, $relations){
83
+            $q->where(\DB::raw('LOWER(CAST('.array_shift($conditionColumns).' AS TEXT))'), 'LIKE', '%'.strtolower($query).'%');
84 84
             foreach ($conditionColumns as $column) 
85 85
             {
86
-                $q->orWhere(\DB::raw('LOWER(CAST(' . $column . ' AS TEXT))'), 'LIKE', '%' . strtolower($query) . '%');
86
+                $q->orWhere(\DB::raw('LOWER(CAST('.$column.' AS TEXT))'), 'LIKE', '%'.strtolower($query).'%');
87 87
             }
88 88
             foreach ($relations as $relation) 
89 89
             {
90 90
                 $relation = explode('.', $relation)[0];
91 91
                 if (\Core::$relation()) 
92 92
                 {
93
-                    $q->orWhereHas($relation, function ($subModel) use ($query, $relation){
93
+                    $q->orWhereHas($relation, function($subModel) use ($query, $relation){
94 94
 
95
-                        $subModel->where(function ($q) use ($query, $relation){
95
+                        $subModel->where(function($q) use ($query, $relation){
96 96
 
97 97
                             $subConditionColumns = \Core::$relation()->model->getFillable();
98
-                            $q->where(\DB::raw('LOWER(CAST(' . array_shift($subConditionColumns) . ' AS TEXT))'), 'LIKE', '%' . strtolower($query) . '%');
98
+                            $q->where(\DB::raw('LOWER(CAST('.array_shift($subConditionColumns).' AS TEXT))'), 'LIKE', '%'.strtolower($query).'%');
99 99
                             foreach ($subConditionColumns as $column)
100 100
                             {
101
-                                $q->orWhere(\DB::raw('LOWER(CAST(' . $column . ' AS TEXT))'), 'LIKE', '%' . strtolower($query) . '%');
101
+                                $q->orWhere(\DB::raw('LOWER(CAST('.$column.' AS TEXT))'), 'LIKE', '%'.strtolower($query).'%');
102 102
                             } 
103 103
                         });
104 104
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $relations  = [];
161 161
         $with       = [];
162 162
 
163
-        \DB::transaction(function () use (&$model, &$relations, &$with, $data, $saveLog, $modelClass) {
163
+        \DB::transaction(function() use (&$model, &$relations, &$with, $data, $saveLog, $modelClass) {
164 164
             /**
165 165
              * If the id is present in the data then select the model for updating,
166 166
              * else create new model.
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $model = array_key_exists('id', $data) ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass;
170 170
             if ( ! $model) 
171 171
             {
172
-                $error = $this->errorHandler->notFound(class_basename($modelClass) . ' with id : ' . $data['id']);
172
+                $error = $this->errorHandler->notFound(class_basename($modelClass).' with id : '.$data['id']);
173 173
                 abort($error['status'], $error['message']);
174 174
             }
175 175
 
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
                                 $relationModel = array_key_exists('id', $val) ? $relationBaseModel->lockForUpdate()->find($val['id']) : new $relationBaseModel;
202 202
                                 if ( ! $relationModel) 
203 203
                                 {
204
-                                    $error = $this->errorHandler->notFound(class_basename($relationBaseModel) . ' with id : ' . $val['id']);
204
+                                    $error = $this->errorHandler->notFound(class_basename($relationBaseModel).' with id : '.$val['id']);
205 205
                                     abort($error['status'], $error['message']);
206 206
                                 }
207 207
 
208 208
                                 foreach ($val as $attr => $val) 
209 209
                                 {
210
-                                    if (gettype($val) !== 'object' && gettype($val) !== 'array' &&  array_search($attr, $relationModel->getFillable(), true) !== false)
210
+                                    if (gettype($val) !== 'object' && gettype($val) !== 'array' && array_search($attr, $relationModel->getFillable(), true) !== false)
211 211
                                     {
212 212
                                         $relationModel->$attr = $val;
213 213
                                     }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                                     $relationModel = array_key_exists('id', $value) ? $relationBaseModel->lockForUpdate()->find($value['id']) : new $relationBaseModel;
222 222
                                     if ( ! $relationModel) 
223 223
                                     {
224
-                                        $error = $this->errorHandler->notFound(class_basename($relationBaseModel) . ' with id : ' . $value['id']);
224
+                                        $error = $this->errorHandler->notFound(class_basename($relationBaseModel).' with id : '.$value['id']);
225 225
                                         abort($error['status'], $error['message']);
226 226
                                     }
227 227
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function saveMany(array $data)
310 310
     {
311 311
         $result = [];
312
-        \DB::transaction(function () use (&$result, $data) {
312
+        \DB::transaction(function() use (&$result, $data) {
313 313
             foreach ($data as $key => $value) 
314 314
             {
315 315
                 $result[] = $this->save($value);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $model ? $model->update($data) : 0;
336 336
             $saveLog ? $this->logs->saveLog('update', class_basename($this->model), $this->getModel(), $value, $model) : false;
337 337
         }
338
-    	call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) use ($data, $saveLog){
338
+    	call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function($model) use ($data, $saveLog){
339 339
             $model->update($data);
340 340
             $saveLog ? $this->logs->saveLog('update', class_basename($this->model), $this->getModel(), $model->id, $model) : false;
341 341
         });
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     {
354 354
     	if ($attribute == 'id') 
355 355
     	{
356
-            \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) {
356
+            \DB::transaction(function() use ($value, $attribute, &$result, $saveLog) {
357 357
                 $model = $this->model->lockForUpdate()->find($value);
358 358
                 $model->delete();
359 359
                 $saveLog ? $this->logs->saveLog('delete', class_basename($this->model), $this->getModel(), $value, $model) : false;
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
     	}
362 362
         else
363 363
         {
364
-            \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) {
365
-                call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model){
364
+            \DB::transaction(function() use ($value, $attribute, &$result, $saveLog) {
365
+                call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function($model) {
366 366
                     $model->delete();
367 367
                     $saveLog ? $this->logs->saveLog('delete', class_basename($this->model), $this->getModel(), $model->id, $model) : false;
368 368
                 });
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     {
400 400
         $conditions = $this->constructConditions($conditions);
401 401
         $sort       = $desc ? 'desc' : 'asc';
402
-        return call_user_func_array("{$this->getModel()}::with",  array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->orderBy($sortBy, $sort)->get($columns);
402
+        return call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->orderBy($sortBy, $sort)->get($columns);
403 403
     }
404 404
 
405 405
     /**
@@ -430,21 +430,21 @@  discard block
 block discarded – undo
430 430
         {
431 431
             if ($key == 'and') 
432 432
             {
433
-                $conditionString  .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']) . ' {op} ';
433
+                $conditionString  .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']).' {op} ';
434 434
                 $conditionValues   = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']);
435 435
             }
436 436
             else if ($key == 'or')
437 437
             {
438
-                $conditionString  .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']) . ' {op} ';
438
+                $conditionString  .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']).' {op} ';
439 439
                 $conditionValues   = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']);
440 440
             }
441 441
             else
442 442
             {
443
-                $conditionString  .= $key . '=? {op} ';
443
+                $conditionString  .= $key.'=? {op} ';
444 444
                 $conditionValues[] = $value;
445 445
             }
446 446
         }
447
-        $conditionString = '(' . rtrim($conditionString, '{op} ') . ')';
447
+        $conditionString = '('.rtrim($conditionString, '{op} ').')';
448 448
         return ['conditionString' => $conditionString, 'conditionValues' => $conditionValues];
449 449
     }
450 450
 
Please login to merge, or discard this patch.
src/Modules/Core/CoreConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
     public function getConfig()
6 6
     {
7 7
     	$customSettings = [];
8
-    	Settings::get(['key', 'value'])->each(function ($setting) use (&$customSettings){
8
+    	Settings::get(['key', 'value'])->each(function($setting) use (&$customSettings){
9 9
     		$customSettings[$setting['key']] = $setting['value'];
10 10
     	});
11 11
 
Please login to merge, or discard this patch.