0cf9602958
Events can be moved to archive and moved back Fixed validation
23 lines
754 B
PHP
23 lines
754 B
PHP
<?php
|
|
|
|
namespace App\Domains\Event\Controllers;
|
|
|
|
use App\Domains\Event\Actions\UnarchiveEvent\UnarchiveEventCommand;
|
|
use App\Domains\Event\Actions\UnarchiveEvent\UnarchiveEventRequest;
|
|
use App\Scopes\CommonController;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class EventUnarchiveController extends CommonController
|
|
{
|
|
public function __invoke(int $eventId, Request $request): JsonResponse {
|
|
$event = $this->events->getById($eventId);
|
|
|
|
$unarchiveRequest = new UnarchiveEventRequest($event);
|
|
$unarchiveCommand = new UnarchiveEventCommand($unarchiveRequest);
|
|
$response = $unarchiveCommand->execute();
|
|
|
|
return response()->json(['status' => $response->success ? 'success' : 'error']);
|
|
}
|
|
}
|