adrema/app/Form/Actions/FormtemplateStoreAction.php

32 lines
708 B
PHP
Raw Normal View History

2023-12-22 20:40:24 +01:00
<?php
namespace App\Form\Actions;
use App\Form\Models\Formtemplate;
2023-12-26 20:06:57 +01:00
use App\Lib\Events\Succeeded;
2023-12-22 20:40:24 +01:00
use Illuminate\Http\JsonResponse;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class FormtemplateStoreAction
{
use AsAction;
2023-12-26 20:24:57 +01:00
use HasValidation;
2023-12-22 20:40:24 +01:00
/**
* @param array<string, mixed> $attributes
*/
public function handle(array $attributes): Formtemplate
{
return Formtemplate::create($attributes);
}
public function asController(ActionRequest $request): JsonResponse
{
$this->handle($request->validated());
2023-12-26 20:06:57 +01:00
Succeeded::message('Vorlage gespeichert.')->dispatch();
2023-12-22 20:40:24 +01:00
return response()->json([]);
}
}