33 lines
971 B
PHP
33 lines
971 B
PHP
<?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
|
|
{
|
|
/** @var string $modelName Name of the model in kebab case. */
|
|
private $modelName = "contact-counts";
|
|
|
|
/**
|
|
* 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,
|
|
]);
|
|
}
|
|
}
|