<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Models\TempUser;

class SendOtpMail extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:send-otp-mail {temp_user_id}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        //
        $user_id = $this->argument("temp_user_id");
        $user = TempUser::find($user_id);
        $email = $user->email;
        $name =  $user->name;
        $otp = $user->user_email_otp;
        $mailbody = view('email_templates.otp_mail', compact('name','email','otp'))->render();
        send_email($email, "Verify Your account", $mailbody);
    
    }
}
