<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;

class ContactController extends Controller
{
    public function showContact() {
        return view('Contact');
    }

   public function storeMessage(Request $request) {
    $data = $request->validate([
        'firstName' => 'required|string|max:255',  
        'lastName' => 'required|string|max:255',  
        'message' => 'required|string',
    ]);

  
    DB::statement('CALL InsertMessage(?, ?, ?)', [$data['firstName'], $data['lastName'], $data['message']]);

    return back()->with('success', 'Message sent successfully!');
}

}
