ldc-groupe/app/Http/Controllers/Back/ContactController.php

34 lines
971 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Back;
use App\Enums\Contact\ContactFormType;
use App\Models\ContactCount;
use Inertia\Inertia;
use Uwil\LaravelBackend\Resources\CommonResource;
use Uwil\LaravelCommon\Controllers\Controller;
class ContactController extends Controller
{
2026-02-10 15:43:47 +01:00
/** @var string $modelName Name of the model in kebab case. */
private $modelName = "contact-counts";
2026-02-10 15:43:47 +01:00
/**
* Display a listing of the resource.
*
* @return \Inertia\Response
*/
public function index(): \Inertia\Response
{
$query = ContactCount::query();
$contactCountModels = $this->paginate($query);
$formTypeEnum = ContactFormType::toArray();
return Inertia::render('ContactCount/Index', [
'contactCountModels' => CommonResource::collection($contactCountModels),
'contactFormType' => $formTypeEnum,
'modelName' => $this->modelName,
]);
}
}