Completed
Push — master ( 122fa1...244647 )
by Sherif
06:20 queued 03:36
created
src/Modules/Acl/Http/Controllers/UsersController.php 1 patch
Spacing   +2 added lines, -2 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
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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/Core/Database/Migrations/2016_01_19_084705_logs.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('logs', function (Blueprint $table) {
15
+		Schema::create('logs', function(Blueprint $table) {
16 16
 			$table->increments('id');
17
-			$table->string('action',100);
18
-			$table->string('item_name',100);
19
-			$table->string('item_type',100);
17
+			$table->string('action', 100);
18
+			$table->string('item_name', 100);
19
+			$table->string('item_type', 100);
20 20
 			$table->integer('item_id');
21 21
 			$table->integer('user_id');
22 22
 			$table->softDeletes();
Please login to merge, or discard this patch.
src/Modules/Core/Utl/ErrorHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,6 +29,6 @@
 block discarded – undo
29 29
 
30 30
     public function notFound($text)
31 31
     {
32
-        return ['status' => 404, 'message' => 'The requested ' . $text . ' not found'];
32
+        return ['status' => 404, 'message' => 'The requested '.$text.' not found'];
33 33
     }
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/Core/Utl/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.
src/Modules/Core/AbstractRepositories/AbstractRepositoryContainer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     {
19 19
     	foreach ($this->getRepoNameSpace() as $repoNameSpace) 
20 20
     	{
21
-            $class = rtrim($repoNameSpace, '\\') . '\\' . ucfirst(str_singular($name)) . 'Repository';
21
+            $class = rtrim($repoNameSpace, '\\').'\\'.ucfirst(str_singular($name)).'Repository';
22 22
     		if (class_exists($class)) 
23 23
     		{
24 24
         		return \App::make($class);
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
@@ -53,26 +53,26 @@  discard block
 block discarded – undo
53 53
         $conditionColumns = $this->model->getFillable();
54 54
         $sort             = $desc ? 'desc' : 'asc';
55 55
 
56
-        $model->where(function ($q) use ($query, $conditionColumns, $relations){
57
-            $q->where(\DB::raw('LOWER(CAST(' . array_shift($conditionColumns) . ' AS TEXT))'), 'LIKE', '%' . strtolower($query) . '%');
56
+        $model->where(function($q) use ($query, $conditionColumns, $relations){
57
+            $q->where(\DB::raw('LOWER(CAST('.array_shift($conditionColumns).' AS TEXT))'), 'LIKE', '%'.strtolower($query).'%');
58 58
             foreach ($conditionColumns as $column) 
59 59
             {
60
-                $q->orWhere(\DB::raw('LOWER(CAST(' . $column . ' AS TEXT))'), 'LIKE', '%' . strtolower($query) . '%');
60
+                $q->orWhere(\DB::raw('LOWER(CAST('.$column.' AS TEXT))'), 'LIKE', '%'.strtolower($query).'%');
61 61
             }
62 62
             foreach ($relations as $relation) 
63 63
             {
64 64
                 $relation = explode('.', $relation)[0];
65 65
                 if (\Core::$relation()) 
66 66
                 {
67
-                    $q->orWhereHas($relation, function ($subModel) use ($query, $relation){
67
+                    $q->orWhereHas($relation, function($subModel) use ($query, $relation){
68 68
 
69
-                        $subModel->where(function ($q) use ($query, $relation){
69
+                        $subModel->where(function($q) use ($query, $relation){
70 70
 
71 71
                             $subConditionColumns = \Core::$relation()->model->getFillable();
72
-                            $q->where(\DB::raw('LOWER(CAST(' . array_shift($subConditionColumns) . ' AS TEXT))'), 'LIKE', '%' . strtolower($query) . '%');
72
+                            $q->where(\DB::raw('LOWER(CAST('.array_shift($subConditionColumns).' AS TEXT))'), 'LIKE', '%'.strtolower($query).'%');
73 73
                             foreach ($subConditionColumns as $column)
74 74
                             {
75
-                                $q->orWhere(\DB::raw('LOWER(CAST(' . $column . ' AS TEXT))'), 'LIKE', '%' . strtolower($query) . '%');
75
+                                $q->orWhere(\DB::raw('LOWER(CAST('.$column.' AS TEXT))'), 'LIKE', '%'.strtolower($query).'%');
76 76
                             } 
77 77
                         });
78 78
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $relations  = [];
135 135
         $with       = [];
136 136
 
137
-        \DB::transaction(function () use (&$model, &$relations, &$with, $data, $saveLog, $modelClass) {
137
+        \DB::transaction(function() use (&$model, &$relations, &$with, $data, $saveLog, $modelClass) {
138 138
             /**
139 139
              * If the id is present in the data then select the model for updating,
140 140
              * else create new model.
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             $model = array_key_exists('id', $data) ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass;
144 144
             if ( ! $model) 
145 145
             {
146
-                $error = \ErrorHandler::notFound(class_basename($modelClass) . ' with id : ' . $data['id']);
146
+                $error = \ErrorHandler::notFound(class_basename($modelClass).' with id : '.$data['id']);
147 147
                 abort($error['status'], $error['message']);
148 148
             }
149 149
 
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
                                 $relationModel = array_key_exists('id', $val) ? $relationBaseModel->lockForUpdate()->find($val['id']) : new $relationBaseModel;
176 176
                                 if ( ! $relationModel) 
177 177
                                 {
178
-                                    $error = \ErrorHandler::notFound(class_basename($relationBaseModel) . ' with id : ' . $val['id']);
178
+                                    $error = \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$val['id']);
179 179
                                     abort($error['status'], $error['message']);
180 180
                                 }
181 181
 
182 182
                                 foreach ($val as $attr => $val) 
183 183
                                 {
184
-                                    if (gettype($val) !== 'object' && gettype($val) !== 'array' &&  array_search($attr, $relationModel->getFillable(), true) !== false)
184
+                                    if (gettype($val) !== 'object' && gettype($val) !== 'array' && array_search($attr, $relationModel->getFillable(), true) !== false)
185 185
                                     {
186 186
                                         $relationModel->$attr = $val;
187 187
                                     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                                     $relationModel = array_key_exists('id', $value) ? $relationBaseModel->lockForUpdate()->find($value['id']) : new $relationBaseModel;
196 196
                                     if ( ! $relationModel) 
197 197
                                     {
198
-                                        $error = \ErrorHandler::notFound(class_basename($relationBaseModel) . ' with id : ' . $value['id']);
198
+                                        $error = \ErrorHandler::notFound(class_basename($relationBaseModel).' with id : '.$value['id']);
199 199
                                         abort($error['status'], $error['message']);
200 200
                                     }
201 201
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     public function saveMany(array $data)
284 284
     {
285 285
         $result = [];
286
-        \DB::transaction(function () use (&$result, $data) {
286
+        \DB::transaction(function() use (&$result, $data) {
287 287
             foreach ($data as $key => $value) 
288 288
             {
289 289
                 $result[] = $this->save($value);
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             $model ? $model->update($data) : 0;
310 310
             $saveLog ? \Logging::saveLog('update', class_basename($this->model), $this->getModel(), $value, $model) : false;
311 311
         }
312
-    	call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model) use ($data, $saveLog){
312
+    	call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function($model) use ($data, $saveLog){
313 313
             $model->update($data);
314 314
             $saveLog ? \Logging::saveLog('update', class_basename($this->model), $this->getModel(), $model->id, $model) : false;
315 315
         });
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
     {
328 328
     	if ($attribute == 'id') 
329 329
     	{
330
-            \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) {
330
+            \DB::transaction(function() use ($value, $attribute, &$result, $saveLog) {
331 331
                 $model = $this->model->lockForUpdate()->find($value);
332 332
                 $model->delete();
333 333
                 $saveLog ? \Logging::saveLog('delete', class_basename($this->model), $this->getModel(), $value, $model) : false;
@@ -335,8 +335,8 @@  discard block
 block discarded – undo
335 335
     	}
336 336
         else
337 337
         {
338
-            \DB::transaction(function () use ($value, $attribute, &$result, $saveLog) {
339
-                call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function ($model){
338
+            \DB::transaction(function() use ($value, $attribute, &$result, $saveLog) {
339
+                call_user_func_array("{$this->getModel()}::where", array($attribute, '=', $value))->lockForUpdate()->get()->each(function($model) {
340 340
                     $model->delete();
341 341
                     $saveLog ? \Logging::saveLog('delete', class_basename($this->model), $this->getModel(), $model->id, $model) : false;
342 342
                 });
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     {
374 374
         $conditions = $this->constructConditions($conditions);
375 375
         $sort       = $desc ? 'desc' : 'asc';
376
-        return call_user_func_array("{$this->getModel()}::with",  array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->orderBy($sortBy, $sort)->get($columns);
376
+        return call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->orderBy($sortBy, $sort)->get($columns);
377 377
     }
378 378
 
379 379
     /**
@@ -404,21 +404,21 @@  discard block
 block discarded – undo
404 404
         {
405 405
             if ($key == 'and') 
406 406
             {
407
-                $conditionString  .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']) . ' {op} ';
407
+                $conditionString  .= str_replace('{op}', 'and', $this->constructConditions($value)['conditionString']).' {op} ';
408 408
                 $conditionValues   = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']);
409 409
             }
410 410
             else if ($key == 'or')
411 411
             {
412
-                $conditionString  .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']) . ' {op} ';
412
+                $conditionString  .= str_replace('{op}', 'or', $this->constructConditions($value)['conditionString']).' {op} ';
413 413
                 $conditionValues   = array_merge($conditionValues, $this->constructConditions($value)['conditionValues']);
414 414
             }
415 415
             else
416 416
             {
417
-                $conditionString  .= $key . '=? {op} ';
417
+                $conditionString  .= $key.'=? {op} ';
418 418
                 $conditionValues[] = $value;
419 419
             }
420 420
         }
421
-        $conditionString = '(' . rtrim($conditionString, '{op} ') . ')';
421
+        $conditionString = '('.rtrim($conditionString, '{op} ').')';
422 422
         return ['conditionString' => $conditionString, 'conditionValues' => $conditionValues];
423 423
     }
424 424
 
Please login to merge, or discard this patch.
src/Modules/Core/Http/Controllers/LogsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
12 12
      * to preform actions like (add, edit ... etc).
13 13
      * @var string
14 14
      */
15
-    protected $model            = 'logs';
15
+    protected $model = 'logs';
16 16
 }
Please login to merge, or discard this patch.
src/Modules/Core/Log.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 Log extends Model{
6
+class Log extends Model {
7 7
 
8 8
     use SoftDeletes;
9 9
     protected $table    = 'logs';
Please login to merge, or discard this patch.