Support oft parent groups
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Admin\Actions\UpdateGlobalSettings;
|
||||
|
||||
use App\Models\GlobalSetting;
|
||||
|
||||
class UpdateGlobalSettingsAction
|
||||
{
|
||||
public function __construct(private UpdateGlobalSettingsRequest $request)
|
||||
{
|
||||
}
|
||||
|
||||
public function execute(): UpdateGlobalSettingsResponse
|
||||
{
|
||||
$response = new UpdateGlobalSettingsResponse();
|
||||
|
||||
$values = [
|
||||
GlobalSetting::LOCAL_GROUP_LABEL => trim($this->request->localGroupLabel),
|
||||
GlobalSetting::LOCAL_GROUP_LABEL_PLURAL => trim($this->request->localGroupLabelPlural),
|
||||
GlobalSetting::PARENT_GROUP_LABEL => trim($this->request->parentGroupLabel),
|
||||
GlobalSetting::PARENT_GROUP_LABEL_PLURAL => trim($this->request->parentGroupLabelPlural),
|
||||
];
|
||||
|
||||
// Eine leere Bezeichnung ließe Überschriften und Auswahlfelder ohne Beschriftung zurück.
|
||||
if (in_array('', $values, true)) {
|
||||
$response->message = 'Bitte alle Bezeichnungen ausfüllen.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->request->globalSettings->setMany($values);
|
||||
|
||||
$response->success = true;
|
||||
$response->message = 'Einstellungen wurden gespeichert.';
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user