*/ final class DeleteRange implements Action { public function __construct( protected readonly StorageService $storageService, protected readonly PublicS3Disk $s3Disk, ) { } /** * @param \App\Cqs\Actions\Ranges\DeleteRangeInput $input */ #[\Override] public function __invoke(ActionInput $input): bool { Assert::isInstanceOf($input, DeleteRangeInput::class); $deletion = (bool) $input->range->deleteOrFail(); if ( $deletion && $input->range->picture && $this->storageService ->fileExistsOnDisk($input->range->picture, $this->s3Disk->disk) ) { $this->storageService->removeFromDisk($input->range->picture, $this->s3Disk->disk); } return $deletion; } }