<?php

namespace App\Http\Controllers;

use App\Mail\ContactUs;
use App\Mail\Consultation;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

class EmailController extends Controller
{
    //
    public function sendEmail(Request $request)
    {   
    // dd($request);
        $name = $request->contact_name;
        $country= $request->country_name;
        $phone = $request->contact_phone;
        $projectType = $request->project_type;
        
        $sentMail = Mail::to('ya.hafiz220@gmail.com')->send(new ContactUs($name, $country, $phone, $projectType));
        if($sentMail){
            // dd('sent');
         return response()->json([
             'status' =>  __('messages.success'),
             'message' => __('your_message_sent_successfully'),
         ]);
        // return redirect()->route('/');
         }
    }
    public function sendConsultationEmail(Request $request)
    {   
        // dd($request);
        $name = $request->consultation_contact_name;
        $phone = $request->consultation_contact_phone;
        $projectType = $request->consultation_project_type;
        
        $sentMail = Mail::to('ya.hafiz220@gmail.com')->send(new Consultation($name, $phone, $projectType));
        if($sentMail){
            // dd('sent');
         return response()->json([
             'status' =>  __('messages.success'),
             'message' => __('your_message_sent_successfully'),
         ]);
        // return redirect()->route('/');
         }
    }
}
