34 lines
675 B
PHP
34 lines
675 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Contact;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\View\View;
|
|
|
|
class ContactController extends Controller
|
|
{
|
|
/**
|
|
* Display Contact Page.
|
|
*/
|
|
public function index(): View
|
|
{
|
|
$contacts = Contact::orderBy('created_at', 'DESC')->get();
|
|
|
|
return view('admin.contact.index', [
|
|
'contacts' => $contacts,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Delete Contact.
|
|
*/
|
|
public function delete(int $contact_id): RedirectResponse
|
|
{
|
|
Contact::where('id', $contact_id)->delete();
|
|
|
|
return redirect()->back();
|
|
}
|
|
}
|