test user notify reset password

This commit is contained in:
ilmedova 2022-12-07 15:07:43 +05:00
parent f662f55ae8
commit fe49e48a31
3 changed files with 70 additions and 44 deletions

View File

@ -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,7 @@
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Lang;
use App\Http\Controllers\Controller;
use App\Notifications\PasswordReset;
class ClientController extends Controller
{
@ -156,7 +155,9 @@ 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));
//Mail::to($request->email)->queue(new ResetPassword());
$user['verification_token'] = $token;

View File

@ -1,41 +0,0 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class ResetPassword extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
public $name;
public $token;
public function __construct($name, $token)
{
$this->name = $name;
$this->token = $token;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$user['name'] = $this->name;
$user['token'] = $this->token;
return $this->view('emails.reset-password', ['user' => $user]);
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class PasswordReset extends Notification
{
use Queueable;
public $name;
public $token;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($name, $token)
{
$this->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 $this->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 [
//
];
}
}