Support oft parent groups

This commit is contained in:
2026-09-29 14:35:33 +02:00
parent c4ca101594
commit a5e4e55df5
86 changed files with 1936 additions and 80 deletions
@@ -0,0 +1,38 @@
<?php
namespace App\Domains\Admin\Actions\DeleteParentGroup;
class DeleteParentGroupAction
{
public function __construct(private DeleteParentGroupRequest $request)
{
}
public function execute(): DeleteParentGroupResponse
{
$response = new DeleteParentGroupResponse();
// Die Fallback-Gruppe nimmt Mandanten ohne Zuordnung auf und muss deshalb bestehen bleiben.
if ($this->request->parentGroup->is_fallback) {
$response->message = sprintf('„%s" kann nicht gelöscht werden.', $this->request->parentGroup->name);
return $response;
}
if ($this->request->inUse) {
$response->message = sprintf(
'„%s" ist noch zugeordnet und kann deshalb nicht gelöscht werden.',
$this->request->parentGroup->name,
);
return $response;
}
$this->request->parentGroup->delete();
$response->success = true;
$response->message = sprintf('„%s" wurde gelöscht.', $this->request->parentGroup->name);
return $response;
}
}