@@ -2,28 +2,28 @@ |
||
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | 4 | |
| 5 | - /** |
|
| 6 | - * List of error messages used in core module. |
|
| 7 | - */ |
|
| 8 | - 'unAuthorized' => 'Please login before any action', |
|
| 9 | - 'invalidRefreshToken' => 'Invalid refresh token', |
|
| 10 | - 'noPermissions' => 'No permissions', |
|
| 11 | - 'loginFailed' => 'Wrong mail or password', |
|
| 12 | - 'noSocialEmail' => 'Couldn\'t retrieve email', |
|
| 13 | - 'userAlreadyRegistered' => 'User already registered. Please login using email and password', |
|
| 14 | - 'connectionError' => 'Connection error', |
|
| 15 | - 'redisNotRunning' => 'Your redis notification server is\'t running', |
|
| 16 | - 'dbQueryError' => 'Please check the given inputes', |
|
| 17 | - 'cannotCreateSetting' => 'Can\'t create setting', |
|
| 18 | - 'cannotUpdateSettingKey' => 'Can\'t update setting key', |
|
| 19 | - 'userIsBlocked' => 'You have been blocked', |
|
| 20 | - 'invalidResetToken' => 'Reset password token is invalid', |
|
| 21 | - 'invalidResetPassword' => 'Reset password is invalid', |
|
| 22 | - 'invalidOldPassword' => 'Old password is invalid', |
|
| 23 | - 'invalidConfirmationCode' => 'Confirmation link expired or already used', |
|
| 24 | - 'notFound' => 'The requested :replace not found', |
|
| 25 | - 'generalError' => 'Something went wrong', |
|
| 26 | - 'emailNotConfirmed' => 'Your email isn\'t confirmed', |
|
| 27 | - 'emailAlreadyConfirmed' => 'Your email is already confirmed' |
|
| 5 | + /** |
|
| 6 | + * List of error messages used in core module. |
|
| 7 | + */ |
|
| 8 | + 'unAuthorized' => 'Please login before any action', |
|
| 9 | + 'invalidRefreshToken' => 'Invalid refresh token', |
|
| 10 | + 'noPermissions' => 'No permissions', |
|
| 11 | + 'loginFailed' => 'Wrong mail or password', |
|
| 12 | + 'noSocialEmail' => 'Couldn\'t retrieve email', |
|
| 13 | + 'userAlreadyRegistered' => 'User already registered. Please login using email and password', |
|
| 14 | + 'connectionError' => 'Connection error', |
|
| 15 | + 'redisNotRunning' => 'Your redis notification server is\'t running', |
|
| 16 | + 'dbQueryError' => 'Please check the given inputes', |
|
| 17 | + 'cannotCreateSetting' => 'Can\'t create setting', |
|
| 18 | + 'cannotUpdateSettingKey' => 'Can\'t update setting key', |
|
| 19 | + 'userIsBlocked' => 'You have been blocked', |
|
| 20 | + 'invalidResetToken' => 'Reset password token is invalid', |
|
| 21 | + 'invalidResetPassword' => 'Reset password is invalid', |
|
| 22 | + 'invalidOldPassword' => 'Old password is invalid', |
|
| 23 | + 'invalidConfirmationCode' => 'Confirmation link expired or already used', |
|
| 24 | + 'notFound' => 'The requested :replace not found', |
|
| 25 | + 'generalError' => 'Something went wrong', |
|
| 26 | + 'emailNotConfirmed' => 'Your email isn\'t confirmed', |
|
| 27 | + 'emailAlreadyConfirmed' => 'Your email is already confirmed' |
|
| 28 | 28 | |
| 29 | 29 | ]; |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class CoreConfig extends Facade |
| 6 | 6 | { |
| 7 | - protected static function getFacadeAccessor() |
|
| 8 | - { |
|
| 9 | - return 'CoreConfig'; |
|
| 10 | - } |
|
| 7 | + protected static function getFacadeAccessor() |
|
| 8 | + { |
|
| 9 | + return 'CoreConfig'; |
|
| 10 | + } |
|
| 11 | 11 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Media extends Facade |
| 6 | 6 | { |
| 7 | - protected static function getFacadeAccessor() |
|
| 8 | - { |
|
| 9 | - return 'Media'; |
|
| 10 | - } |
|
| 7 | + protected static function getFacadeAccessor() |
|
| 8 | + { |
|
| 9 | + return 'Media'; |
|
| 10 | + } |
|
| 11 | 11 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Core extends Facade |
| 6 | 6 | { |
| 7 | - protected static function getFacadeAccessor() |
|
| 8 | - { |
|
| 9 | - return 'Core'; |
|
| 10 | - } |
|
| 7 | + protected static function getFacadeAccessor() |
|
| 8 | + { |
|
| 9 | + return 'Core'; |
|
| 10 | + } |
|
| 11 | 11 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class ErrorHandler extends Facade |
| 6 | 6 | { |
| 7 | - protected static function getFacadeAccessor() |
|
| 8 | - { |
|
| 9 | - return 'ErrorHandler'; |
|
| 10 | - } |
|
| 7 | + protected static function getFacadeAccessor() |
|
| 8 | + { |
|
| 9 | + return 'ErrorHandler'; |
|
| 10 | + } |
|
| 11 | 11 | } |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | class ApiConsumer extends Facade |
| 6 | 6 | { |
| 7 | - protected static function getFacadeAccessor() |
|
| 8 | - { |
|
| 9 | - return 'ApiConsumer'; |
|
| 10 | - } |
|
| 7 | + protected static function getFacadeAccessor() |
|
| 8 | + { |
|
| 9 | + return 'ApiConsumer'; |
|
| 10 | + } |
|
| 11 | 11 | } |
@@ -2,17 +2,17 @@ |
||
| 2 | 2 | |
| 3 | 3 | class CoreConfig |
| 4 | 4 | { |
| 5 | - public function getConfig() |
|
| 6 | - { |
|
| 7 | - return [ |
|
| 8 | - /** |
|
| 9 | - * Specify what relations should be used for every model. |
|
| 10 | - */ |
|
| 11 | - 'relations' => config('skeleton.relations'), |
|
| 12 | - /** |
|
| 13 | - * Specify caching config for each api. |
|
| 14 | - */ |
|
| 15 | - 'cacheConfig' => config('skeleton.cache_config'), |
|
| 16 | - ]; |
|
| 17 | - } |
|
| 5 | + public function getConfig() |
|
| 6 | + { |
|
| 7 | + return [ |
|
| 8 | + /** |
|
| 9 | + * Specify what relations should be used for every model. |
|
| 10 | + */ |
|
| 11 | + 'relations' => config('skeleton.relations'), |
|
| 12 | + /** |
|
| 13 | + * Specify caching config for each api. |
|
| 14 | + */ |
|
| 15 | + 'cacheConfig' => config('skeleton.cache_config'), |
|
| 16 | + ]; |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -2,62 +2,62 @@ |
||
| 2 | 2 | |
| 3 | 3 | class Media |
| 4 | 4 | { |
| 5 | - /** |
|
| 6 | - * Upload the given image. |
|
| 7 | - * |
|
| 8 | - * @param object $image |
|
| 9 | - * @param string $dir |
|
| 10 | - * @return string |
|
| 11 | - */ |
|
| 12 | - public function uploadImage($image, $dir) |
|
| 13 | - { |
|
| 14 | - $image = \Image::make($image); |
|
| 15 | - return $this->saveImage($image, $dir); |
|
| 16 | - } |
|
| 5 | + /** |
|
| 6 | + * Upload the given image. |
|
| 7 | + * |
|
| 8 | + * @param object $image |
|
| 9 | + * @param string $dir |
|
| 10 | + * @return string |
|
| 11 | + */ |
|
| 12 | + public function uploadImage($image, $dir) |
|
| 13 | + { |
|
| 14 | + $image = \Image::make($image); |
|
| 15 | + return $this->saveImage($image, $dir); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Upload the given image. |
|
| 20 | - * |
|
| 21 | - * @param object $image |
|
| 22 | - * @param string $dir |
|
| 23 | - * @return string |
|
| 24 | - */ |
|
| 25 | - public function uploadImageBas64($image, $dir) |
|
| 26 | - { |
|
| 27 | - if (! strlen($image)) { |
|
| 28 | - return null; |
|
| 29 | - } |
|
| 18 | + /** |
|
| 19 | + * Upload the given image. |
|
| 20 | + * |
|
| 21 | + * @param object $image |
|
| 22 | + * @param string $dir |
|
| 23 | + * @return string |
|
| 24 | + */ |
|
| 25 | + public function uploadImageBas64($image, $dir) |
|
| 26 | + { |
|
| 27 | + if (! strlen($image)) { |
|
| 28 | + return null; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
| 32 | - $image = \Image::make($base); |
|
| 31 | + $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
| 32 | + $image = \Image::make($base); |
|
| 33 | 33 | |
| 34 | - return $this->saveImage($image, $dir); |
|
| 35 | - } |
|
| 34 | + return $this->saveImage($image, $dir); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Delete the given image. |
|
| 39 | - * |
|
| 40 | - * @param object $path |
|
| 41 | - * @return void |
|
| 42 | - */ |
|
| 43 | - public function deleteImage($path) |
|
| 44 | - { |
|
| 45 | - \Storage::delete($path); |
|
| 46 | - } |
|
| 37 | + /** |
|
| 38 | + * Delete the given image. |
|
| 39 | + * |
|
| 40 | + * @param object $path |
|
| 41 | + * @return void |
|
| 42 | + */ |
|
| 43 | + public function deleteImage($path) |
|
| 44 | + { |
|
| 45 | + \Storage::delete($path); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Save the given image. |
|
| 50 | - * |
|
| 51 | - * @param object $image |
|
| 52 | - * @param string $dir |
|
| 53 | - * @return string |
|
| 54 | - */ |
|
| 55 | - protected function saveImage($image, $dir) |
|
| 56 | - { |
|
| 57 | - $imageName = 'image'.uniqid().time().'.jpg'; |
|
| 58 | - $path = 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$imageName; |
|
| 59 | - \Storage::put($path, $image->stream()); |
|
| 48 | + /** |
|
| 49 | + * Save the given image. |
|
| 50 | + * |
|
| 51 | + * @param object $image |
|
| 52 | + * @param string $dir |
|
| 53 | + * @return string |
|
| 54 | + */ |
|
| 55 | + protected function saveImage($image, $dir) |
|
| 56 | + { |
|
| 57 | + $imageName = 'image'.uniqid().time().'.jpg'; |
|
| 58 | + $path = 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$imageName; |
|
| 59 | + \Storage::put($path, $image->stream()); |
|
| 60 | 60 | |
| 61 | - return $path; |
|
| 62 | - } |
|
| 61 | + return $path; |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function uploadImageBas64($image, $dir) |
| 26 | 26 | { |
| 27 | - if (! strlen($image)) { |
|
| 27 | + if ( ! strlen($image)) { |
|
| 28 | 28 | return null; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -2,123 +2,123 @@ |
||
| 2 | 2 | |
| 3 | 3 | class ErrorHandler |
| 4 | 4 | { |
| 5 | - public function unAuthorized() |
|
| 6 | - { |
|
| 7 | - $error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')]; |
|
| 8 | - abort($error['status'], $error['message']); |
|
| 9 | - } |
|
| 10 | - |
|
| 11 | - public function invalidRefreshToken() |
|
| 12 | - { |
|
| 13 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')]; |
|
| 14 | - abort($error['status'], $error['message']); |
|
| 15 | - } |
|
| 16 | - |
|
| 17 | - public function noPermissions() |
|
| 18 | - { |
|
| 19 | - $error = ['status' => 403, 'message' => trans('core::errors.noPermissions')]; |
|
| 20 | - abort($error['status'], $error['message']); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function loginFailed() |
|
| 24 | - { |
|
| 25 | - $error = ['status' => 400, 'message' => trans('core::errors.loginFailed')]; |
|
| 26 | - abort($error['status'], $error['message']); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - public function noSocialEmail() |
|
| 30 | - { |
|
| 31 | - $error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')]; |
|
| 32 | - abort($error['status'], $error['message']); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function userAlreadyRegistered() |
|
| 36 | - { |
|
| 37 | - $error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')]; |
|
| 38 | - abort($error['status'], $error['message']); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - public function connectionError() |
|
| 42 | - { |
|
| 43 | - $error = ['status' => 400, 'message' => trans('core::errors.connectionError')]; |
|
| 44 | - abort($error['status'], $error['message']); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - public function redisNotRunning() |
|
| 48 | - { |
|
| 49 | - $error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')]; |
|
| 50 | - abort($error['status'], $error['message']); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function dbQueryError() |
|
| 54 | - { |
|
| 55 | - $error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')]; |
|
| 56 | - abort($error['status'], $error['message']); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - public function cannotCreateSetting() |
|
| 60 | - { |
|
| 61 | - $error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')]; |
|
| 62 | - abort($error['status'], $error['message']); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - public function cannotUpdateSettingKey() |
|
| 66 | - { |
|
| 67 | - $error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')]; |
|
| 68 | - abort($error['status'], $error['message']); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - public function userIsBlocked() |
|
| 72 | - { |
|
| 73 | - $error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')]; |
|
| 74 | - abort($error['status'], $error['message']); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - public function emailNotConfirmed() |
|
| 78 | - { |
|
| 79 | - $error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')]; |
|
| 80 | - abort($error['status'], $error['message']); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - public function emailAlreadyConfirmed() |
|
| 84 | - { |
|
| 85 | - $error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')]; |
|
| 86 | - abort($error['status'], $error['message']); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - public function invalidResetToken() |
|
| 90 | - { |
|
| 91 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')]; |
|
| 92 | - abort($error['status'], $error['message']); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - public function invalidResetPassword() |
|
| 96 | - { |
|
| 97 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')]; |
|
| 98 | - abort($error['status'], $error['message']); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - public function invalidOldPassword() |
|
| 102 | - { |
|
| 103 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')]; |
|
| 104 | - abort($error['status'], $error['message']); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - public function invalidConfirmationCode() |
|
| 108 | - { |
|
| 109 | - $error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')]; |
|
| 110 | - abort($error['status'], $error['message']); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - public function notFound($text) |
|
| 114 | - { |
|
| 115 | - $error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])]; |
|
| 116 | - abort($error['status'], $error['message']); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - public function generalError() |
|
| 120 | - { |
|
| 121 | - $error = ['status' => 400, 'message' => trans('core::errors.generalError')]; |
|
| 122 | - abort($error['status'], $error['message']); |
|
| 123 | - } |
|
| 5 | + public function unAuthorized() |
|
| 6 | + { |
|
| 7 | + $error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')]; |
|
| 8 | + abort($error['status'], $error['message']); |
|
| 9 | + } |
|
| 10 | + |
|
| 11 | + public function invalidRefreshToken() |
|
| 12 | + { |
|
| 13 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')]; |
|
| 14 | + abort($error['status'], $error['message']); |
|
| 15 | + } |
|
| 16 | + |
|
| 17 | + public function noPermissions() |
|
| 18 | + { |
|
| 19 | + $error = ['status' => 403, 'message' => trans('core::errors.noPermissions')]; |
|
| 20 | + abort($error['status'], $error['message']); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function loginFailed() |
|
| 24 | + { |
|
| 25 | + $error = ['status' => 400, 'message' => trans('core::errors.loginFailed')]; |
|
| 26 | + abort($error['status'], $error['message']); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + public function noSocialEmail() |
|
| 30 | + { |
|
| 31 | + $error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')]; |
|
| 32 | + abort($error['status'], $error['message']); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function userAlreadyRegistered() |
|
| 36 | + { |
|
| 37 | + $error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')]; |
|
| 38 | + abort($error['status'], $error['message']); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + public function connectionError() |
|
| 42 | + { |
|
| 43 | + $error = ['status' => 400, 'message' => trans('core::errors.connectionError')]; |
|
| 44 | + abort($error['status'], $error['message']); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + public function redisNotRunning() |
|
| 48 | + { |
|
| 49 | + $error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')]; |
|
| 50 | + abort($error['status'], $error['message']); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function dbQueryError() |
|
| 54 | + { |
|
| 55 | + $error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')]; |
|
| 56 | + abort($error['status'], $error['message']); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + public function cannotCreateSetting() |
|
| 60 | + { |
|
| 61 | + $error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')]; |
|
| 62 | + abort($error['status'], $error['message']); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + public function cannotUpdateSettingKey() |
|
| 66 | + { |
|
| 67 | + $error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')]; |
|
| 68 | + abort($error['status'], $error['message']); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + public function userIsBlocked() |
|
| 72 | + { |
|
| 73 | + $error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')]; |
|
| 74 | + abort($error['status'], $error['message']); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + public function emailNotConfirmed() |
|
| 78 | + { |
|
| 79 | + $error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')]; |
|
| 80 | + abort($error['status'], $error['message']); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + public function emailAlreadyConfirmed() |
|
| 84 | + { |
|
| 85 | + $error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')]; |
|
| 86 | + abort($error['status'], $error['message']); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + public function invalidResetToken() |
|
| 90 | + { |
|
| 91 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')]; |
|
| 92 | + abort($error['status'], $error['message']); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + public function invalidResetPassword() |
|
| 96 | + { |
|
| 97 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')]; |
|
| 98 | + abort($error['status'], $error['message']); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + public function invalidOldPassword() |
|
| 102 | + { |
|
| 103 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')]; |
|
| 104 | + abort($error['status'], $error['message']); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + public function invalidConfirmationCode() |
|
| 108 | + { |
|
| 109 | + $error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')]; |
|
| 110 | + abort($error['status'], $error['message']); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + public function notFound($text) |
|
| 114 | + { |
|
| 115 | + $error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])]; |
|
| 116 | + abort($error['status'], $error['message']); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + public function generalError() |
|
| 120 | + { |
|
| 121 | + $error = ['status' => 400, 'message' => trans('core::errors.generalError')]; |
|
| 122 | + abort($error['status'], $error['message']); |
|
| 123 | + } |
|
| 124 | 124 | } |