@@ -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 | } |
@@ -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,43 +10,43 @@ |
||
10 | 10 | |
11 | 11 | class ResetPassword extends Notification implements ShouldQueue |
12 | 12 | { |
13 | - use Queueable; |
|
13 | + use Queueable; |
|
14 | 14 | |
15 | - protected $token; |
|
15 | + protected $token; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Create a new notification instance. |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function __construct($token) |
|
23 | - { |
|
24 | - $this->$token = $token; |
|
25 | - } |
|
17 | + /** |
|
18 | + * Create a new notification instance. |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function __construct($token) |
|
23 | + { |
|
24 | + $this->$token = $token; |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Get the notification's delivery channels. |
|
29 | - * |
|
30 | - * @param mixed $notifiable |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - public function via($notifiable) |
|
34 | - { |
|
35 | - return ['mail']; |
|
36 | - } |
|
27 | + /** |
|
28 | + * Get the notification's delivery channels. |
|
29 | + * |
|
30 | + * @param mixed $notifiable |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + public function via($notifiable) |
|
34 | + { |
|
35 | + return ['mail']; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Get the mail representation of the notification. |
|
40 | - * |
|
41 | - * @param mixed $notifiable |
|
42 | - * @return \Illuminate\Notifications\Messages\MailMessage |
|
43 | - */ |
|
44 | - public function toMail($notifiable) |
|
45 | - { |
|
46 | - return (new MailMessage) |
|
47 | - ->subject('Reset passowrd') |
|
48 | - ->line('Reset passowrd') |
|
49 | - ->line('To reset your password click on the button below') |
|
50 | - ->action('Reset password', env('RESET_PASSWORD_URL') . '/' . $this->token); |
|
51 | - } |
|
38 | + /** |
|
39 | + * Get the mail representation of the notification. |
|
40 | + * |
|
41 | + * @param mixed $notifiable |
|
42 | + * @return \Illuminate\Notifications\Messages\MailMessage |
|
43 | + */ |
|
44 | + public function toMail($notifiable) |
|
45 | + { |
|
46 | + return (new MailMessage) |
|
47 | + ->subject('Reset passowrd') |
|
48 | + ->line('Reset passowrd') |
|
49 | + ->line('To reset your password click on the button below') |
|
50 | + ->action('Reset password', env('RESET_PASSWORD_URL') . '/' . $this->token); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | \ 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 |