ldc-boutique-cnc/app/Events/PasswordHasReset.php
2023-02-13 14:57:01 +01:00

27 lines
764 B
PHP

<?php
namespace App\Events;
use App\Notifications\Customer\UpdatePassword as NotificationUpdatePassword;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
class PasswordHasReset
{
/**
* Handle the given event.
*
* @param \Illuminate\Auth\Events\PasswordReset $event
* @return void
*/
public function handle(PasswordReset $event)
{
/** @var \App\Models\Customer */
$customer = $event->user;
$customer->notify(new NotificationUpdatePassword());
Auth::guard('frontend')->login($customer);
Session::flash('success', trans('Votre mot de passe à bien été réinitialisé, vous êtes à présent connecté.'));
}
}