@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | |
3 | 3 | class CoreConfig |
4 | 4 | { |
5 | - public function getConfig() |
|
6 | - { |
|
7 | - return [ |
|
5 | + public function getConfig() |
|
6 | + { |
|
7 | + return [ |
|
8 | 8 | /** |
9 | 9 | * Specify what relations should be used for every model. |
10 | 10 | */ |
@@ -133,5 +133,5 @@ discard block |
||
133 | 133 | ] |
134 | 134 | ] |
135 | 135 | ]; |
136 | - } |
|
136 | + } |
|
137 | 137 | } |
138 | 138 | \ No newline at end of file |
@@ -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 | - $response = []; |
|
15 | - $image = $image; |
|
16 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
17 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
18 | - |
|
19 | - ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
20 | - $image->move($destinationPath, $imageName); |
|
21 | - |
|
22 | - return url($destinationPath . $imageName); |
|
23 | - } |
|
24 | - |
|
25 | - /** |
|
26 | - * Upload the given image. |
|
27 | - * |
|
28 | - * @param object $image |
|
29 | - * @param string $dir |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function uploadImageBas64($image, $dir) |
|
33 | - { |
|
34 | - $response = []; |
|
35 | - $image = $image; |
|
36 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
37 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
38 | - |
|
39 | - ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
40 | - |
|
41 | - $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
42 | - $image = \Image::make($base)->save($destinationPath . $imageName); |
|
43 | - |
|
44 | - return url($destinationPath . $imageName); |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Delete the given image. |
|
49 | - * |
|
50 | - * @param object $path |
|
51 | - * @param string $dir |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function deleteImage($path, $dir) |
|
55 | - { |
|
56 | - $arr = explode('/', $path); |
|
57 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
58 | - if (\File::exists($path)) |
|
59 | - { |
|
60 | - \File::delete($path); |
|
61 | - } |
|
62 | - } |
|
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 | + $response = []; |
|
15 | + $image = $image; |
|
16 | + $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
17 | + $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
18 | + |
|
19 | + ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
20 | + $image->move($destinationPath, $imageName); |
|
21 | + |
|
22 | + return url($destinationPath . $imageName); |
|
23 | + } |
|
24 | + |
|
25 | + /** |
|
26 | + * Upload the given image. |
|
27 | + * |
|
28 | + * @param object $image |
|
29 | + * @param string $dir |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function uploadImageBas64($image, $dir) |
|
33 | + { |
|
34 | + $response = []; |
|
35 | + $image = $image; |
|
36 | + $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
37 | + $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
38 | + |
|
39 | + ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
40 | + |
|
41 | + $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
42 | + $image = \Image::make($base)->save($destinationPath . $imageName); |
|
43 | + |
|
44 | + return url($destinationPath . $imageName); |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Delete the given image. |
|
49 | + * |
|
50 | + * @param object $path |
|
51 | + * @param string $dir |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function deleteImage($path, $dir) |
|
55 | + { |
|
56 | + $arr = explode('/', $path); |
|
57 | + $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
58 | + if (\File::exists($path)) |
|
59 | + { |
|
60 | + \File::delete($path); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | { |
14 | 14 | $response = []; |
15 | 15 | $image = $image; |
16 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
17 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
16 | + $imageName = str_slug('image'.uniqid().time().'_'.$image->getClientOriginalName()); |
|
17 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
18 | 18 | |
19 | 19 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
20 | 20 | $image->move($destinationPath, $imageName); |
21 | 21 | |
22 | - return url($destinationPath . $imageName); |
|
22 | + return url($destinationPath.$imageName); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | { |
34 | 34 | $response = []; |
35 | 35 | $image = $image; |
36 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
37 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
36 | + $imageName = 'image'.uniqid().time().'.jpg'; |
|
37 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
38 | 38 | |
39 | 39 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
40 | 40 | |
41 | 41 | $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
42 | - $image = \Image::make($base)->save($destinationPath . $imageName); |
|
42 | + $image = \Image::make($base)->save($destinationPath.$imageName); |
|
43 | 43 | |
44 | - return url($destinationPath . $imageName); |
|
44 | + return url($destinationPath.$imageName); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function deleteImage($path, $dir) |
55 | 55 | { |
56 | 56 | $arr = explode('/', $path); |
57 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
57 | + $path = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.end($arr); |
|
58 | 58 | if (\File::exists($path)) |
59 | 59 | { |
60 | 60 | \File::delete($path); |
@@ -2,117 +2,117 @@ |
||
2 | 2 | |
3 | 3 | class ErrorHandler |
4 | 4 | { |
5 | - public function unAuthorized() |
|
6 | - { |
|
7 | - $error = ['status' => 401, 'message' => trans('errors.unAuthorized')]; |
|
8 | - abort($error['status'], $error['message']); |
|
9 | - } |
|
10 | - |
|
11 | - public function invalidRefreshToken() |
|
12 | - { |
|
13 | - $error = ['status' => 401, 'message' => trans('errors.invalidRefreshToken')]; |
|
14 | - abort($error['status'], $error['message']); |
|
15 | - } |
|
16 | - |
|
17 | - public function noPermissions() |
|
18 | - { |
|
19 | - $error = ['status' => 403, 'message' => trans('errors.noPermissions')]; |
|
20 | - abort($error['status'], $error['message']); |
|
21 | - } |
|
22 | - |
|
23 | - public function loginFailed() |
|
24 | - { |
|
25 | - $error = ['status' => 400, 'message' => trans('errors.loginFailed')]; |
|
26 | - abort($error['status'], $error['message']); |
|
27 | - } |
|
28 | - |
|
29 | - public function noSocialEmail() |
|
30 | - { |
|
31 | - $error = ['status' => 400, 'message' => trans('errors.noSocialEmail')]; |
|
32 | - abort($error['status'], $error['message']); |
|
33 | - } |
|
34 | - |
|
35 | - public function userAlreadyRegistered() |
|
36 | - { |
|
37 | - $error = ['status' => 400, 'message' => trans('errors.userAlreadyRegistered')]; |
|
38 | - abort($error['status'], $error['message']); |
|
39 | - } |
|
40 | - |
|
41 | - public function connectionError() |
|
42 | - { |
|
43 | - $error = ['status' => 400, 'message' => trans('errors.connectionError')]; |
|
44 | - abort($error['status'], $error['message']); |
|
45 | - } |
|
46 | - |
|
47 | - public function redisNotRunning() |
|
48 | - { |
|
49 | - $error = ['status' => 400, 'message' => trans('errors.redisNotRunning')]; |
|
50 | - abort($error['status'], $error['message']); |
|
51 | - } |
|
52 | - |
|
53 | - public function dbQueryError() |
|
54 | - { |
|
55 | - $error = ['status' => 400, 'message' => trans('errors.dbQueryError')]; |
|
56 | - abort($error['status'], $error['message']); |
|
57 | - } |
|
58 | - |
|
59 | - public function cannotCreateSetting() |
|
60 | - { |
|
61 | - $error = ['status' => 400, 'message' => trans('errors.cannotCreateSetting')]; |
|
62 | - abort($error['status'], $error['message']); |
|
63 | - } |
|
64 | - |
|
65 | - public function cannotUpdateSettingKey() |
|
66 | - { |
|
67 | - $error = ['status' => 400, 'message' => trans('errors.cannotUpdateSettingKey')]; |
|
68 | - abort($error['status'], $error['message']); |
|
69 | - } |
|
70 | - |
|
71 | - public function userIsBlocked() |
|
72 | - { |
|
73 | - $error = ['status' => 403, 'message' => trans('errors.userIsBlocked')]; |
|
74 | - abort($error['status'], $error['message']); |
|
75 | - } |
|
76 | - |
|
77 | - public function emailNotConfirmed() |
|
78 | - { |
|
79 | - $error = ['status' => 403, 'message' => trans('errors.emailNotConfirmed')]; |
|
80 | - abort($error['status'], $error['message']); |
|
81 | - } |
|
82 | - |
|
83 | - public function emailAlreadyConfirmed() |
|
84 | - { |
|
85 | - $error = ['status' => 403, 'message' => trans('errors.emailAlreadyConfirmed')]; |
|
86 | - abort($error['status'], $error['message']); |
|
87 | - } |
|
88 | - |
|
89 | - public function invalidResetToken() |
|
90 | - { |
|
91 | - $error = ['status' => 400, 'message' => trans('errors.invalidResetToken')]; |
|
92 | - abort($error['status'], $error['message']); |
|
93 | - } |
|
94 | - |
|
95 | - public function invalidResetPassword() |
|
96 | - { |
|
97 | - $error = ['status' => 400, 'message' => trans('errors.invalidResetPassword')]; |
|
98 | - abort($error['status'], $error['message']); |
|
99 | - } |
|
100 | - |
|
101 | - public function invalidOldPassword() |
|
102 | - { |
|
103 | - $error = ['status' => 400, 'message' => trans('errors.invalidOldPassword')]; |
|
104 | - abort($error['status'], $error['message']); |
|
105 | - } |
|
106 | - |
|
107 | - public function notFound($text) |
|
108 | - { |
|
109 | - $error = ['status' => 404, 'message' => trans('errors.notFound', ['replace' => $text])]; |
|
110 | - abort($error['status'], $error['message']); |
|
111 | - } |
|
112 | - |
|
113 | - public function generalError() |
|
114 | - { |
|
115 | - $error = ['status' => 400, 'message' => trans('errors.generalError')]; |
|
116 | - abort($error['status'], $error['message']); |
|
117 | - } |
|
5 | + public function unAuthorized() |
|
6 | + { |
|
7 | + $error = ['status' => 401, 'message' => trans('errors.unAuthorized')]; |
|
8 | + abort($error['status'], $error['message']); |
|
9 | + } |
|
10 | + |
|
11 | + public function invalidRefreshToken() |
|
12 | + { |
|
13 | + $error = ['status' => 401, 'message' => trans('errors.invalidRefreshToken')]; |
|
14 | + abort($error['status'], $error['message']); |
|
15 | + } |
|
16 | + |
|
17 | + public function noPermissions() |
|
18 | + { |
|
19 | + $error = ['status' => 403, 'message' => trans('errors.noPermissions')]; |
|
20 | + abort($error['status'], $error['message']); |
|
21 | + } |
|
22 | + |
|
23 | + public function loginFailed() |
|
24 | + { |
|
25 | + $error = ['status' => 400, 'message' => trans('errors.loginFailed')]; |
|
26 | + abort($error['status'], $error['message']); |
|
27 | + } |
|
28 | + |
|
29 | + public function noSocialEmail() |
|
30 | + { |
|
31 | + $error = ['status' => 400, 'message' => trans('errors.noSocialEmail')]; |
|
32 | + abort($error['status'], $error['message']); |
|
33 | + } |
|
34 | + |
|
35 | + public function userAlreadyRegistered() |
|
36 | + { |
|
37 | + $error = ['status' => 400, 'message' => trans('errors.userAlreadyRegistered')]; |
|
38 | + abort($error['status'], $error['message']); |
|
39 | + } |
|
40 | + |
|
41 | + public function connectionError() |
|
42 | + { |
|
43 | + $error = ['status' => 400, 'message' => trans('errors.connectionError')]; |
|
44 | + abort($error['status'], $error['message']); |
|
45 | + } |
|
46 | + |
|
47 | + public function redisNotRunning() |
|
48 | + { |
|
49 | + $error = ['status' => 400, 'message' => trans('errors.redisNotRunning')]; |
|
50 | + abort($error['status'], $error['message']); |
|
51 | + } |
|
52 | + |
|
53 | + public function dbQueryError() |
|
54 | + { |
|
55 | + $error = ['status' => 400, 'message' => trans('errors.dbQueryError')]; |
|
56 | + abort($error['status'], $error['message']); |
|
57 | + } |
|
58 | + |
|
59 | + public function cannotCreateSetting() |
|
60 | + { |
|
61 | + $error = ['status' => 400, 'message' => trans('errors.cannotCreateSetting')]; |
|
62 | + abort($error['status'], $error['message']); |
|
63 | + } |
|
64 | + |
|
65 | + public function cannotUpdateSettingKey() |
|
66 | + { |
|
67 | + $error = ['status' => 400, 'message' => trans('errors.cannotUpdateSettingKey')]; |
|
68 | + abort($error['status'], $error['message']); |
|
69 | + } |
|
70 | + |
|
71 | + public function userIsBlocked() |
|
72 | + { |
|
73 | + $error = ['status' => 403, 'message' => trans('errors.userIsBlocked')]; |
|
74 | + abort($error['status'], $error['message']); |
|
75 | + } |
|
76 | + |
|
77 | + public function emailNotConfirmed() |
|
78 | + { |
|
79 | + $error = ['status' => 403, 'message' => trans('errors.emailNotConfirmed')]; |
|
80 | + abort($error['status'], $error['message']); |
|
81 | + } |
|
82 | + |
|
83 | + public function emailAlreadyConfirmed() |
|
84 | + { |
|
85 | + $error = ['status' => 403, 'message' => trans('errors.emailAlreadyConfirmed')]; |
|
86 | + abort($error['status'], $error['message']); |
|
87 | + } |
|
88 | + |
|
89 | + public function invalidResetToken() |
|
90 | + { |
|
91 | + $error = ['status' => 400, 'message' => trans('errors.invalidResetToken')]; |
|
92 | + abort($error['status'], $error['message']); |
|
93 | + } |
|
94 | + |
|
95 | + public function invalidResetPassword() |
|
96 | + { |
|
97 | + $error = ['status' => 400, 'message' => trans('errors.invalidResetPassword')]; |
|
98 | + abort($error['status'], $error['message']); |
|
99 | + } |
|
100 | + |
|
101 | + public function invalidOldPassword() |
|
102 | + { |
|
103 | + $error = ['status' => 400, 'message' => trans('errors.invalidOldPassword')]; |
|
104 | + abort($error['status'], $error['message']); |
|
105 | + } |
|
106 | + |
|
107 | + public function notFound($text) |
|
108 | + { |
|
109 | + $error = ['status' => 404, 'message' => trans('errors.notFound', ['replace' => $text])]; |
|
110 | + abort($error['status'], $error['message']); |
|
111 | + } |
|
112 | + |
|
113 | + public function generalError() |
|
114 | + { |
|
115 | + $error = ['status' => 400, 'message' => trans('errors.generalError')]; |
|
116 | + abort($error['status'], $error['message']); |
|
117 | + } |
|
118 | 118 | } |
119 | 119 | \ No newline at end of file |
@@ -10,41 +10,41 @@ |
||
10 | 10 | |
11 | 11 | class ConfirmEmail extends Notification implements ShouldQueue |
12 | 12 | { |
13 | - use Queueable; |
|
13 | + use Queueable; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Create a new notification instance. |
|
17 | - * |
|
18 | - * @return void |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - // |
|
23 | - } |
|
15 | + /** |
|
16 | + * Create a new notification instance. |
|
17 | + * |
|
18 | + * @return void |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + // |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Get the notification's delivery channels. |
|
27 | - * |
|
28 | - * @param mixed $notifiable |
|
29 | - * @return array |
|
30 | - */ |
|
31 | - public function via($notifiable) |
|
32 | - { |
|
33 | - return ['mail']; |
|
34 | - } |
|
25 | + /** |
|
26 | + * Get the notification's delivery channels. |
|
27 | + * |
|
28 | + * @param mixed $notifiable |
|
29 | + * @return array |
|
30 | + */ |
|
31 | + public function via($notifiable) |
|
32 | + { |
|
33 | + return ['mail']; |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Get the mail representation of the notification. |
|
38 | - * |
|
39 | - * @param mixed $notifiable |
|
40 | - * @return \Illuminate\Notifications\Messages\MailMessage |
|
41 | - */ |
|
42 | - public function toMail($notifiable) |
|
43 | - { |
|
44 | - return (new MailMessage) |
|
45 | - ->subject('Email verification') |
|
46 | - ->line('Email verification') |
|
47 | - ->line('To validate your email click on the button below') |
|
48 | - ->action('Verify your email', env('CONFIRM_EMAIL_URL') . '/' . $notifiable->confirmation_code)); |
|
49 | - } |
|
36 | + /** |
|
37 | + * Get the mail representation of the notification. |
|
38 | + * |
|
39 | + * @param mixed $notifiable |
|
40 | + * @return \Illuminate\Notifications\Messages\MailMessage |
|
41 | + */ |
|
42 | + public function toMail($notifiable) |
|
43 | + { |
|
44 | + return (new MailMessage) |
|
45 | + ->subject('Email verification') |
|
46 | + ->line('Email verification') |
|
47 | + ->line('To validate your email click on the button below') |
|
48 | + ->action('Verify your email', env('CONFIRM_EMAIL_URL') . '/' . $notifiable->confirmation_code)); |
|
49 | + } |
|
50 | 50 | } |
51 | 51 | \ No newline at end of file |
@@ -45,6 +45,6 @@ |
||
45 | 45 | ->subject('Email verification') |
46 | 46 | ->line('Email verification') |
47 | 47 | ->line('To validate your email click on the button below') |
48 | - ->action('Verify your email', env('CONFIRM_EMAIL_URL') . '/' . $notifiable->confirmation_code)); |
|
48 | + ->action('Verify your email', env('CONFIRM_EMAIL_URL').'/'.$notifiable->confirmation_code)); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | \ No newline at end of file |