diff --git a/app/Http/Controllers/API/ClientController.php b/app/Http/Controllers/API/ClientController.php index ceb2ea0d..7ce7bf2e 100644 --- a/app/Http/Controllers/API/ClientController.php +++ b/app/Http/Controllers/API/ClientController.php @@ -8,7 +8,6 @@ use App\Http\Requests\API\ClientRequest; use App\Http\Resources\ClientResource; use App\Mail\EmailVerification; -use App\Mail\ResetPassword; use App\Models\Account; use App\Models\Client; use Illuminate\Http\Request; @@ -18,7 +17,8 @@ use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Lang; use App\Http\Controllers\Controller; - +use App\Notifications\EmailVerify; +use App\Notifications\PasswordReset; class ClientController extends Controller { @@ -70,16 +70,7 @@ public function signup(RegisterRequest $request){ if($email_verification) { $client->verification_token = rand(10000, 99999); - - //try{ - Mail::to($request->email) - ->queue(new EmailVerification($request->firstname, $client->verification_token)); - // }catch (\Exception $ex){ - // //eger email ugradyp bolmasa verification edip bolmaz - // $client->is_verified = true; - // Log::error($ex->getMessage()); - // } - + $client->notify(new EmailVerify($request->firstname, $client->verification_token)); } $account = Account::create([ @@ -88,7 +79,6 @@ public function signup(RegisterRequest $request){ ]); $client->account()->associate($account)->save(); - if($client->is_verified){ Auth::login($client); $client->token = $client->createToken('auth_token')->plainTextToken; @@ -156,7 +146,7 @@ public function sendPasswordResetLinkEmail(Request $request) { $token = rand(1000, 9999); - Mail::to($request->email)->queue(new ResetPassword($user->firstname, $token)); + $user->notify(new PasswordReset($user->firstname, $token)); $user['verification_token'] = $token; diff --git a/app/Mail/ApplicationApproved.php b/app/Mail/ApplicationApproved.php deleted file mode 100644 index bf7399c6..00000000 --- a/app/Mail/ApplicationApproved.php +++ /dev/null @@ -1,33 +0,0 @@ -view('view.name'); - } -} diff --git a/app/Mail/ApplicationRefined.php b/app/Mail/ApplicationRefined.php deleted file mode 100644 index 55b738e2..00000000 --- a/app/Mail/ApplicationRefined.php +++ /dev/null @@ -1,33 +0,0 @@ -name = $name; - } - - /** - * Build the message. - * - * @return $this - */ - public function build() - { - $user['name'] = $this->name; - - return $this->subject('Your application has been refined!') - ->view('emails.notifications.application_refined', ['user' => $user]); - } -} diff --git a/app/Mail/EmailVerification.php b/app/Mail/EmailVerification.php deleted file mode 100755 index 57127453..00000000 --- a/app/Mail/EmailVerification.php +++ /dev/null @@ -1,41 +0,0 @@ -name = $name; - $this->token = $token; - } - - /** - * Build the message. - * - * @return $this - */ - public function build() - { - $user['name'] = $this->name; - $user['token'] = $this->token; - - return $this->subject('Verify your email') - ->view('emails.email-verification', ['user' => $user]); - } -} diff --git a/app/Mail/ResetPassword.php b/app/Mail/ResetPassword.php deleted file mode 100755 index d8a84b86..00000000 --- a/app/Mail/ResetPassword.php +++ /dev/null @@ -1,42 +0,0 @@ -name = $name; - $this->token = $token; - } - - /** - * Build the message. - * - * @return $this - */ - public function build() - { - $user['name'] = $this->name; - $user['token'] = $this->token; - - return $this->subject('Resetting your password') - ->view('emails.reset-password', ['user' => $user]); - } -} diff --git a/app/Notifications/ApplicationApproved.php b/app/Notifications/ApplicationApproved.php index 4eab4afd..400947e2 100644 --- a/app/Notifications/ApplicationApproved.php +++ b/app/Notifications/ApplicationApproved.php @@ -40,7 +40,8 @@ public function via($notifiable) */ public function toMail($notifiable) { - return (new MailMessage)->view('emails.notifications.application_approved'); + return (new MailMessage)->subject('Application approved!') + ->view('emails.notifications.application_approved'); } /** diff --git a/app/Notifications/ApplicationRefined.php b/app/Notifications/ApplicationRefined.php index 09774ab5..5f5995ad 100644 --- a/app/Notifications/ApplicationRefined.php +++ b/app/Notifications/ApplicationRefined.php @@ -40,7 +40,8 @@ public function via($notifiable) */ public function toMail($notifiable) { - return (new MailMessage)->view('emails.notifications.application_refined'); + return (new MailMessage)->subject('Application refined!') + ->view('emails.notifications.application_refined'); } /** diff --git a/app/Notifications/EmailVerify.php b/app/Notifications/EmailVerify.php new file mode 100644 index 00000000..540507bf --- /dev/null +++ b/app/Notifications/EmailVerify.php @@ -0,0 +1,66 @@ +name = $name; + $this->token = $token; + } + + /** + * Get the notification's delivery channels. + * + * @param mixed $notifiable + * @return array + */ + public function via($notifiable) + { + return ['mail']; + } + + /** + * Get the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + $user['name'] = $this->name; + $user['token'] = $this->token; + + return (new MailMessage)->subject('Verify your email') + ->view('emails.email-verification', ['user' => $user]); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/app/Notifications/PasswordReset.php b/app/Notifications/PasswordReset.php new file mode 100644 index 00000000..60509a0d --- /dev/null +++ b/app/Notifications/PasswordReset.php @@ -0,0 +1,66 @@ +name = $name; + $this->token = $token; + } + + /** + * Get the notification's delivery channels. + * + * @param mixed $notifiable + * @return array + */ + public function via($notifiable) + { + return ['mail']; + } + + /** + * Get the mail representation of the notification. + * + * @param mixed $notifiable + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + $user['name'] = $this->name; + $user['token'] = $this->token; + + return (new MailMessage)->subject('Resetting your password') + ->view('emails.reset-password', ['user' => $user]); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/app/Notifications/TicketMessage.php b/app/Notifications/TicketMessage.php index 00d0cfb5..f9c82f02 100644 --- a/app/Notifications/TicketMessage.php +++ b/app/Notifications/TicketMessage.php @@ -40,7 +40,8 @@ public function via($notifiable) */ public function toMail($notifiable) { - return (new MailMessage)->view('emails.notifications.new_message'); + return (new MailMessage)->subject('You have new message!') + ->view('emails.notifications.new_message'); } /** diff --git a/app/Notifications/TicketPosted.php b/app/Notifications/TicketPosted.php index c912ab8b..e223c253 100644 --- a/app/Notifications/TicketPosted.php +++ b/app/Notifications/TicketPosted.php @@ -40,7 +40,8 @@ public function via($notifiable) */ public function toMail($notifiable) { - return (new MailMessage)->view('emails.notifications.new_ticket'); + return (new MailMessage)->subject('New ticket created.') + ->view('emails.notifications.new_ticket'); } /** diff --git a/resources/views/emails/email-verification.blade.php b/resources/views/emails/email-verification.blade.php index 287d33e6..3eb93ee6 100755 --- a/resources/views/emails/email-verification.blade.php +++ b/resources/views/emails/email-verification.blade.php @@ -1,71 +1,84 @@ - +
- - -|
- |
|
+
+ Вы указали текущий адрес электронной почты для регистрации в личном кабинете на сайте ГТСБТ. |
+
|
+
+ С уважением, |
+
|
- |
|
+ + Код для сброса пароля: {{$user['token']}} + + |
+
|
+
+ С уважением, |
+