<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\Contact;

class ContactController extends Controller
{
    /**
     * Display Contact Page.
     */
    public function index(): \Illuminate\View\View
    {
        $contacts = Contact::orderBy('created_at', 'DESC')->get();

        return view('admin.contact.index', [
            'contacts' => $contacts
        ]);
    }

    /**
     * Delete Contact.
     */
    public function delete(int $contact_id): \Illuminate\Http\RedirectResponse
    {
        Contact::where('id', $contact_id)->delete();

        return redirect()->back();
    }
}
