Files
mareike/app/Domains/Event/Controllers/EventArchiveController.php
T
th.guenther 0cf9602958 Direct payments for invoices
Events can be moved to archive and moved back
Fixed validation
2026-05-12 16:04:15 +02:00

26 lines
934 B
PHP

<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\ArchiveEvent\ArchiveEventCommand;
use App\Domains\Event\Actions\ArchiveEvent\ArchiveEventRequest;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class EventArchiveController extends CommonController
{
public function __invoke(string $eventId, Request $request): JsonResponse {
$event = $this->events->getByIdentifier($eventId);
$archiveEventRequest = new ArchiveEventRequest($event);
$archiveEventCommand = new ArchiveEventCommand($archiveEventRequest);
$response = $archiveEventCommand->execute();
return response()->json([
'status' => $response->success ? 'success' : 'error',
'message' => $response->success ? 'Das Event wurde erfolgreich archiviert.' : 'Beim Archivieren des Events ist ein Fehler aufgetreten.'
]);
}
}