Skip to content

Instantly share code, notes, and snippets.

@cod3beat
Created November 18, 2015 06:52
Show Gist options
  • Save cod3beat/539f7834f10eea2bdacd to your computer and use it in GitHub Desktop.
Save cod3beat/539f7834f10eea2bdacd to your computer and use it in GitHub Desktop.
PublishUnpublishedChallengeHandler.php tanpa tugas sekunder
<?php
class PublishUnpublishedChallengeHandler
{
public function handle(PublishUnpublishedChallenge $command)
{
try {
DB::beginTransaction();
$publishedChallenge = $this->challengePublicationContext->publishUnpublishedChallenge($command->challenge_id);
DB::commit();
} catch (Exception $e) {
DB::rollback();
throw $e;
}
// Dispatch Domain Event
$this->dispatchEventsFor($publishedChallenge);
return new PublishUnpublishedChallengeResponse($publishedChallenge);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment