<?php

namespace App\Http\Controllers;
use App\Http\Requests\ContactFormRequest;
use App\Models\Contact; 
use Illuminate\Http\Request;

class ContactController extends Controller
{
    public function store(ContactFormRequest $request)
    {
        // Save the form data in the database
        Contact::create($request->all());

        // Return a JSON response for the AJAX request
        return response()->json(['success' => 'Message sent successfully!']);
    }
}
