adrema/app/Prevention/Actions/SettingStoreAction.php

34 lines
722 B
PHP
Raw Normal View History

2024-07-04 21:01:14 +02:00
<?php
namespace App\Prevention\Actions;
2024-07-04 23:54:37 +02:00
use App\Lib\Editor\EditorData;
2024-07-04 21:01:14 +02:00
use App\Lib\Events\Succeeded;
use App\Prevention\PreventionSettings;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
class SettingStoreAction
{
use AsAction;
2024-07-08 23:06:45 +02:00
/**
* @return array<string, string>
*/
2024-07-04 21:01:14 +02:00
public function rules(): array
{
return [
'formmail' => 'array',
];
}
public function handle(ActionRequest $request): void
{
2024-07-04 23:54:37 +02:00
$settings = app(PreventionSettings::class);
$settings->formmail = EditorData::from($request->formmail);
$settings->save();
2024-07-04 21:01:14 +02:00
Succeeded::message('Einstellungen gespeichert.')->dispatch();
}
}