<?php

namespace App\Http\Controllers;

use App\Http\Requests\ContactUsRequest;
use App\Models\ContactUs;
use App\Models\ContactUsPage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class ContactUsPageController extends Controller
{

    public function __invoke()
    {
        $about = ContactUsPage::first();
        Log::info(ContactUsPage::first());
        if ($about) {
            return $about->makeHidden(['id', 'created_at', 'updated_at']);
        } else {
            return response()->json(['message' => 'No record found'], 404);
        }
    }
    public function cont(ContactUsRequest $request)
    {
        // $this->authorize('create-contact-us');
        ContactUs::create($request->validated());
        return response()->json([
            "message" => "your message send it",
            'status' => 202
        ], 202);
    }
}
