<?php
namespace App\Http\Controllers\API;
use Illuminate\Http\Request; 
use App\Http\Controllers\Controller; 
use App\Models\ContactUs;

class ContactUsController extends Controller {
    
    public function index(Request $request) {
        
        $contactUs          = new ContactUs();
        $contactUs->user_id = auth()->user()->id;
        $contactUs->name    = request('name');
        $contactUs->email   = request('email');
        $contactUs->subject = request('subject');
        $contactUs->message = request('message');
        $contactUs->save();
        
        return response()->json([
            'success' => 1,
            'data'    => $contactUs,
            'message' => 'Thanks for contacting us! We will be in touch with you shortly.'
        ], 200);
        
    }
}