<?php

namespace Modules\Internal\Listeners;

use App\Models\User;
use Modules\Internal\Events\ForgetPassword;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Mail;
use Modules\Internal\Notifications\NotifyVerifyEmail;

class SendVerifyEmail
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param ForgetPassword $event
     * @return void
     */
    public function handle(ForgetPassword $event)
    {
        User::where('email', $event->data['email'])
            ->each(function ($user) use ($event) {
                $user->notify(new NotifyVerifyEmail($event->data));
            });
    }
}
