<?php

namespace App\Http\Controllers\Frontend;

use App\Http\Controllers\Controller;
use App\Http\Requests\Frontend\StoreContactRequest;
use App\Models\SettingManagement\Contact;

class ContactController extends Controller{

    public function index(){
        return view('frontend.contact.index');
    }

    public function store(StoreContactRequest $request){
        Contact::create($request->validated() + [
            "customer_id" =>  auth()->id() ?? null
        ]);


        return redirect()->route('home')
            ->with([
                'message' => __('Thank you for contacting us! One of our staff members will get in touch with you within 24 hours👍.'),
                'alert-type' => 'success'
            ]);
    }
}
