adrema/app/Contribution/Actions/FormAction.php

37 lines
842 B
PHP
Raw Normal View History

2022-11-17 21:47:45 +01:00
<?php
namespace App\Contribution\Actions;
use App\Contribution\ContributionFactory;
use App\Country;
use Inertia\Inertia;
use Inertia\Response;
use Lorisleiva\Actions\Concerns\AsAction;
class FormAction
{
use AsAction;
/**
* @return array<string, mixed>
*/
public function handle(): array
{
return [
2023-02-26 20:51:59 +01:00
'countries' => Country::select('name', 'id')->get(),
'data' => [
'country' => Country::firstWhere('name', 'Deutschland')->id,
],
2022-11-17 21:47:45 +01:00
'compilers' => app(ContributionFactory::class)->compilerSelect(),
];
}
public function asController(): Response
{
session()->put('menu', 'contribution');
session()->put('title', 'Zuschüsse');
return Inertia::render('contribution/VIndex', $this->handle());
}
}