<?php

namespace App\Http\Controllers\API;

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

use App\Models\Contactus;

class ContactusAPIController extends Controller
{
    public function doSubmit(Request $request)
    {
        try{
            $post = $request->all();
            $user_id = 0;            
            if($request->userAuthData){
                $user_id = $request->userAuthData->user_id;
            }
            $post['user_id']    = $user_id;
            $post['created_at'] = date("Y-m-d H:i:s");
            $post['updated_at'] = date("Y-m-d H:i:s");
            Contactus::insert($post);
            return $this->sendResponse([], 'Submited Succefully');
        } catch (\Exception $ex) {
            return $this->sendError($ex->getMessage());
        }
    }
}
