This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class NewsFeedServiceProvider extends ServiceProvider | |
{ | |
public function register() | |
{ | |
// Ketika seluruh event dari Domain Challenge dibangkitkan, maka kita jalankan ChallengeFeedListener | |
// untuk menangani event tersebut. | |
\Event::listen('Dicoding.Domain.Challenge.*', 'Dicoding\Infrastructure\Feeds\Challenges\ChallengeFeedListener'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class EventMailerServiceProvider extends ServiceProvider | |
{ | |
public function register() | |
{ | |
// Ketika seluruh event dari Domain Challenge dibangkitkan, maka kita jalankan ChallengeEventMailer | |
// untuk menangani event tersebut. | |
\Event::listen('Dicoding.Domain.Challenge.*', 'Dicoding\Infrastructure\Emailing\Challenge\ChallengeEventMailer'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ChallengePublicationContext | |
{ | |
public function publishUnpublishedChallenge($challengeId) | |
{ | |
// Jalankan logika bisnis yang berhubungan dengan | |
// proses mempublikasikan unpublised challenge | |
// Bila sukses, maka kita tambahkan Challenge ini ke |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PublishUnpublishedChallengeHandler | |
{ | |
public function handle(PublishUnpublishedChallenge $command) | |
{ | |
try { | |
DB::beginTransaction(); | |
$publishedChallenge = $this->challengePublicationContext->publishUnpublishedChallenge($command->challenge_id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PublishUnpublishedChallengeHandler | |
{ | |
public function handle(PublishUnpublishedChallenge $command) | |
{ | |
try { | |
DB::beginTransaction(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Dicoding\ApplicationService\Challenges; | |
class CreateUnpublishedChallengeHandler | |
{ | |
public function handle(CreateUnpublishedChallenge $command) | |
{ | |
try { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class EmailMembershipController | |
{ | |
public function store() | |
{ | |
try { | |
$this->execute(RegisterDeveloper::class); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Dicoding\ApplicationService\Administration\NotifyPendingTaskCommand; | |
use Illuminate\Console\Command; | |
class DailyTaskNotifier extends Command | |
{ | |
// code lain disembunyikan agar contoh ini menjadi lebih ringkas | |
public function fire() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ChallengeController | |
{ | |
public function store() | |
{ | |
try { | |
$this->commandBus()->handle(new CreateUnpublishedChallenge( | |
'Nama', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ChallengeController | |
{ | |
public function store() | |
{ | |
try { | |
// Mengeksekusi Command | |
$this->execute(CreateUnpublishedChallenge::class); | |