@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @param array $relations |
| 53 | 53 | * @param string $sortBy |
| 54 | - * @param boolean $desc |
|
| 54 | + * @param integer $desc |
|
| 55 | 55 | * @param array $columns |
| 56 | 56 | * @return collection |
| 57 | 57 | */ |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param integer $perPage |
| 70 | 70 | * @param array $relations |
| 71 | 71 | * @param string $sortBy |
| 72 | - * @param boolean $desc |
|
| 72 | + * @param integer $desc |
|
| 73 | 73 | * @param array $columns |
| 74 | 74 | * @return collection |
| 75 | 75 | */ |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param integer $perPage |
| 117 | 117 | * @param array $relations |
| 118 | 118 | * @param string $sortBy |
| 119 | - * @param boolean $desc |
|
| 119 | + * @param integer $desc |
|
| 120 | 120 | * @param array $columns |
| 121 | 121 | * @return collection |
| 122 | 122 | */ |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @param integer $perPage |
| 135 | 135 | * @param array $relations |
| 136 | 136 | * @param string $sortBy |
| 137 | - * @param boolean $desc |
|
| 137 | + * @param integer $desc |
|
| 138 | 138 | * @param array $columns |
| 139 | 139 | * @return collection |
| 140 | 140 | */ |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | * @param array $conditions array of conditions |
| 392 | 392 | * @param array $relations |
| 393 | 393 | * @param string $sortBy |
| 394 | - * @param boolean $desc |
|
| 394 | + * @param integer $desc |
|
| 395 | 395 | * @param array $columns |
| 396 | 396 | * @return collection |
| 397 | 397 | */ |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | * |
| 409 | 409 | * @param array $conditions array of conditions |
| 410 | 410 | * @param array $relations |
| 411 | - * @param array $colunmns |
|
| 411 | + * @param array $columns |
|
| 412 | 412 | * @return object |
| 413 | 413 | */ |
| 414 | 414 | public function first($conditions, $relations = [], $columns = array('*')) |
@@ -452,9 +452,9 @@ discard block |
||
| 452 | 452 | * Abstract method that is called in after |
| 453 | 453 | * the save method finish. |
| 454 | 454 | * |
| 455 | - * @param object $model |
|
| 455 | + * @param boolean $model |
|
| 456 | 456 | * @param array $relations |
| 457 | - * @return void |
|
| 457 | + * @return boolean |
|
| 458 | 458 | */ |
| 459 | 459 | protected function afterSave($model, $relations) |
| 460 | 460 | { |
@@ -79,26 +79,26 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -54,9 +54,7 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * Fetch all records with relations from model repository. |
| 56 | 56 | * |
| 57 | - * @param string $sortBy |
|
| 58 | - * @param boolean $desc |
|
| 59 | - * @return \Illuminate\Http\Response |
|
| 57 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 60 | 58 | */ |
| 61 | 59 | public function getIndex() |
| 62 | 60 | { |
@@ -71,7 +69,7 @@ discard block |
||
| 71 | 69 | * Fetch the single object with relations from model repository. |
| 72 | 70 | * |
| 73 | 71 | * @param integer $id |
| 74 | - * @return \Illuminate\Http\Response |
|
| 72 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 75 | 73 | */ |
| 76 | 74 | public function getFind($id) |
| 77 | 75 | { |
@@ -89,8 +87,8 @@ discard block |
||
| 89 | 87 | * @param string $query |
| 90 | 88 | * @param integer $perPage |
| 91 | 89 | * @param string $sortBy |
| 92 | - * @param boolean $desc |
|
| 93 | - * @return \Illuminate\Http\Response |
|
| 90 | + * @param integer $desc |
|
| 91 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 94 | 92 | */ |
| 95 | 93 | public function getSearch($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 96 | 94 | { |
@@ -107,8 +105,8 @@ discard block |
||
| 107 | 105 | * |
| 108 | 106 | * @param \Illuminate\Http\Request $request |
| 109 | 107 | * @param string $sortBy |
| 110 | - * @param boolean $desc |
|
| 111 | - * @return \Illuminate\Http\Response |
|
| 108 | + * @param integer $desc |
|
| 109 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 112 | 110 | */ |
| 113 | 111 | public function postFindby(Request $request, $sortBy = 'created_at', $desc = 1) |
| 114 | 112 | { |
@@ -124,7 +122,7 @@ discard block |
||
| 124 | 122 | * condition. |
| 125 | 123 | * |
| 126 | 124 | * @param \Illuminate\Http\Request $request |
| 127 | - * @return \Illuminate\Http\Response |
|
| 125 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 128 | 126 | */ |
| 129 | 127 | public function postFirst(Request $request) |
| 130 | 128 | { |
@@ -140,8 +138,8 @@ discard block |
||
| 140 | 138 | * |
| 141 | 139 | * @param integer $perPage |
| 142 | 140 | * @param string $sortBy |
| 143 | - * @param boolean $desc |
|
| 144 | - * @return \Illuminate\Http\Response |
|
| 141 | + * @param integer $desc |
|
| 142 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 145 | 143 | */ |
| 146 | 144 | public function getPaginate($perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 147 | 145 | { |
@@ -159,8 +157,8 @@ discard block |
||
| 159 | 157 | * @param \Illuminate\Http\Request $request |
| 160 | 158 | * @param integer $perPage |
| 161 | 159 | * @param string $sortBy |
| 162 | - * @param boolean $desc |
|
| 163 | - * @return \Illuminate\Http\Response |
|
| 160 | + * @param integer $desc |
|
| 161 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 164 | 162 | */ |
| 165 | 163 | public function postPaginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 166 | 164 | { |
@@ -175,7 +173,7 @@ discard block |
||
| 175 | 173 | * Save the given model to repository. |
| 176 | 174 | * |
| 177 | 175 | * @param \Illuminate\Http\Request $request |
| 178 | - * @return \Illuminate\Http\Response |
|
| 176 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 179 | 177 | */ |
| 180 | 178 | public function postSave(Request $request) |
| 181 | 179 | { |
@@ -208,7 +206,7 @@ discard block |
||
| 208 | 206 | * Delete by the given id from model repository. |
| 209 | 207 | * |
| 210 | 208 | * @param integer $id |
| 211 | - * @return \Illuminate\Http\Response |
|
| 209 | + * @return \Illuminate\Http\JsonResponse|null |
|
| 212 | 210 | */ |
| 213 | 211 | public function getDelete($id) |
| 214 | 212 | { |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $this->skipLoginCheck = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : []; |
| 48 | 48 | |
| 49 | 49 | $this->relations = array_key_exists($this->model, $this->config['relations']) ? $this->config['relations'][$this->model] : false; |
| 50 | - $route = explode('@',\Route::currentRouteAction())[1]; |
|
| 50 | + $route = explode('@', \Route::currentRouteAction())[1]; |
|
| 51 | 51 | $this->checkPermission(explode('_', snake_case($route))[1]); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | * @param array $relations |
| 9 | 9 | * @param array $sortBy |
| 10 | - * @param array $desc |
|
| 10 | + * @param integer $desc |
|
| 11 | 11 | * @param array $columns |
| 12 | 12 | * @return collection |
| 13 | 13 | */ |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param integer $perPage |
| 22 | 22 | * @param array $relations |
| 23 | 23 | * @param array $sortBy |
| 24 | - * @param array $desc |
|
| 24 | + * @param integer $desc |
|
| 25 | 25 | * @param array $columns |
| 26 | 26 | * @return collection |
| 27 | 27 | */ |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param integer $perPage |
| 34 | 34 | * @param array $relations |
| 35 | 35 | * @param array $sortBy |
| 36 | - * @param array $desc |
|
| 36 | + * @param integer $desc |
|
| 37 | 37 | * @param array $columns |
| 38 | 38 | * @return collection |
| 39 | 39 | */ |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param integer $perPage |
| 48 | 48 | * @param array $relations |
| 49 | 49 | * @param array $sortBy |
| 50 | - * @param array $desc |
|
| 50 | + * @param integer $desc |
|
| 51 | 51 | * @param array $columns |
| 52 | 52 | * @return collection |
| 53 | 53 | */ |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param array $conditions array of conditions |
| 110 | 110 | * @param array $relations |
| 111 | 111 | * @param array $sortBy |
| 112 | - * @param array $desc |
|
| 112 | + * @param integer $desc |
|
| 113 | 113 | * @param array $columns |
| 114 | 114 | * @return collection |
| 115 | 115 | */ |
@@ -120,7 +120,6 @@ discard block |
||
| 120 | 120 | * condition. |
| 121 | 121 | * |
| 122 | 122 | * @param array $conditions array of conditions |
| 123 | - * @param [type] $value condition value |
|
| 124 | 123 | * @param array $relations |
| 125 | 124 | * @param array $columns |
| 126 | 125 | * @return object |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | * |
| 47 | 47 | * @param array $conditions array of conditions |
| 48 | 48 | * @param array $relations |
| 49 | - * @param array $colunmns |
|
| 49 | + * @param array $columns |
|
| 50 | 50 | * @return object |
| 51 | 51 | */ |
| 52 | 52 | public function first($conditions, $relations = [], $columns = array('*')) |
@@ -3,7 +3,7 @@ discard block |
||
| 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 |
||
| 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() |
@@ -23,11 +23,11 @@ discard block |
||
| 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 ?: \Auth::user(); |
| 29 | 29 | $permissions = []; |
| 30 | - \Core::users()->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){ |
|
| 30 | + \Core::users()->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function($permission) use (&$permissions, $model){ |
|
| 31 | 31 | $permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); |
| 32 | 32 | }); |
| 33 | 33 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function assignGroups($user_id, $group_ids) |
| 57 | 57 | { |
| 58 | - \DB::transaction(function () use ($user_id, $group_ids) { |
|
| 58 | + \DB::transaction(function() use ($user_id, $group_ids) { |
|
| 59 | 59 | $user = \Core::users()->find($user_id); |
| 60 | 60 | $user->groups()->detach(); |
| 61 | 61 | $user->groups()->attach($group_ids); |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function assignPermissions($group_id, $permission_ids) |
| 25 | 25 | { |
| 26 | - \DB::transaction(function () use ($group_id, $permission_ids) { |
|
| 26 | + \DB::transaction(function() use ($group_id, $permission_ids) { |
|
| 27 | 27 | $group = \Core::groups()->find($group_id); |
| 28 | 28 | $group->permissions()->detach(); |
| 29 | 29 | $group->permissions()->attach($permission_ids); |
@@ -13,14 +13,14 @@ |
||
| 13 | 13 | * to preform actions like (add, edit ... etc). |
| 14 | 14 | * @var string |
| 15 | 15 | */ |
| 16 | - protected $model = 'groups'; |
|
| 16 | + protected $model = 'groups'; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * The validations rules used by the base api controller |
| 20 | 20 | * to check before add. |
| 21 | 21 | * @var array |
| 22 | 22 | */ |
| 23 | - protected $validationRules = [ |
|
| 23 | + protected $validationRules = [ |
|
| 24 | 24 | 'name' => 'required|string|max:100|unique:groups,name,{id}' |
| 25 | 25 | ]; |
| 26 | 26 | |
@@ -12,7 +12,7 @@ discard block |
||
| 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 |
||
| 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 | ]; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function postRegister(Request $request) |
| 69 | 69 | { |
| 70 | - $this->validate($request, ['email' => 'required|email|unique:users,email,{id}','password' => 'required|min:6']); |
|
| 70 | + $this->validate($request, ['email' => 'required|email|unique:users,email,{id}', 'password' => 'required|min:6']); |
|
| 71 | 71 | |
| 72 | 72 | return \Response::json(\Auth::loginUsingId(\Core::users()->create($request->all())->id), 200); |
| 73 | 73 | } |