0cf9602958
Events can be moved to archive and moved back Fixed validation
26 lines
934 B
PHP
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.'
|
|
]);
|
|
}
|
|
}
|