<?php

namespace App\Http\Controllers\User;

use App\Http\Controllers\Controller;
use App\Traits\PHPCustomMail;
use Illuminate\Http\Request;

class UserContactController extends Controller
{
    use PHPCustomMail;
    public function userEmergencyContactSubmit(Request $request)
    {

        $first_name = $request->first_name;
        $last_name = $request->last_name;
        $email = $request->email;
        $user_location = $request->user_location;

        $view = view('user.email.contact-email', compact(['email', 'user_location', 'first_name', 'last_name']))->render();

        $data = [
            'from' => 'Support@gmail.com',
            'to' => $request->email,
            'subject' => 'Contact Information',
            'body' => $view,
        ];
        $this->customMail($data['from'], $data['to'], $data['subject'], $data['body']);

        return redirect()->route('front.index')->with('success', 'Your request has been sent successfully!');

    }
}
