2023-12-31 22:35:13 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Form\Actions;
|
|
|
|
|
|
|
|
use App\Form\Models\Form;
|
|
|
|
use App\Form\Resources\FormResource;
|
|
|
|
use Illuminate\Pagination\LengthAwarePaginator;
|
|
|
|
use Inertia\Inertia;
|
|
|
|
use Inertia\Response;
|
|
|
|
use Lorisleiva\Actions\Concerns\AsAction;
|
|
|
|
|
|
|
|
class FormIndexAction
|
|
|
|
{
|
|
|
|
use AsAction;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return LengthAwarePaginator<Form>
|
|
|
|
*/
|
|
|
|
public function handle(): LengthAwarePaginator
|
|
|
|
{
|
|
|
|
return Form::paginate(15);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function asController(): Response
|
|
|
|
{
|
2024-01-01 18:29:33 +01:00
|
|
|
session()->put('menu', 'form');
|
|
|
|
session()->put('title', 'Veranstaltungen');
|
|
|
|
|
2023-12-31 22:35:13 +01:00
|
|
|
return Inertia::render('form/Index', [
|
|
|
|
'data' => FormResource::collection($this->handle()),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|