@@ -52,32 +52,26 @@ |
||
| 52 | 52 | { |
| 53 | 53 | $error = \ErrorHandler::dbQueryError(); |
| 54 | 54 | return \Response::json($error['message'], $error['status']); |
| 55 | - } |
|
| 56 | - else if ($e instanceof \predis\connection\connectionexception) |
|
| 55 | + } else if ($e instanceof \predis\connection\connectionexception) |
|
| 57 | 56 | { |
| 58 | 57 | $error = \ErrorHandler::redisNotRunning(); |
| 59 | 58 | return \Response::json($error['message'], $error['status']); |
| 60 | - } |
|
| 61 | - else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) |
|
| 59 | + } else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) |
|
| 62 | 60 | { |
| 63 | 61 | $error = \ErrorHandler::tokenExpired(); |
| 64 | 62 | return \Response::json($error['message'], $error['status']); |
| 65 | - } |
|
| 66 | - else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) |
|
| 63 | + } else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) |
|
| 67 | 64 | { |
| 68 | 65 | $error = \ErrorHandler::noPermissions(); |
| 69 | 66 | return \Response::json($error['message'], $error['status']); |
| 70 | - } |
|
| 71 | - else if ($e instanceof \Tymon\JWTAuth\Exceptions\JWTException) |
|
| 67 | + } else if ($e instanceof \Tymon\JWTAuth\Exceptions\JWTException) |
|
| 72 | 68 | { |
| 73 | 69 | $error = \ErrorHandler::unAuthorized(); |
| 74 | 70 | return \Response::json($error['message'], $error['status']); |
| 75 | - } |
|
| 76 | - else if ($e instanceof HttpException) |
|
| 71 | + } else if ($e instanceof HttpException) |
|
| 77 | 72 | { |
| 78 | 73 | return \Response::json($e->getMessage(), $e->getStatusCode()); |
| 79 | - } |
|
| 80 | - else |
|
| 74 | + } else |
|
| 81 | 75 | { |
| 82 | 76 | return parent::render($request, $e); |
| 83 | 77 | } |
@@ -190,8 +190,7 @@ discard block |
||
| 190 | 190 | if ($request->has('id')) |
| 191 | 191 | { |
| 192 | 192 | $rule = str_replace('{id}', $request->get('id'), $rule); |
| 193 | - } |
|
| 194 | - else |
|
| 193 | + } else |
|
| 195 | 194 | { |
| 196 | 195 | $rule = str_replace(',{id}', '', $rule); |
| 197 | 196 | } |
@@ -232,8 +231,7 @@ discard block |
||
| 232 | 231 | { |
| 233 | 232 | $error = $this->errorHandler->notFound('method'); |
| 234 | 233 | abort($error['status'], $error['message']); |
| 235 | - } |
|
| 236 | - else if ( ! in_array($permission, $this->skipLoginCheck)) |
|
| 234 | + } else if ( ! in_array($permission, $this->skipLoginCheck)) |
|
| 237 | 235 | { |
| 238 | 236 | \JWTAuth::parseToken()->authenticate(); |
| 239 | 237 | if ( ! in_array($permission, $this->skipPermissionCheck) && ! \Core::users()->can($permission, $this->model)) |
@@ -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 | ]; |