Skip to content

Instantly share code, notes, and snippets.

@cod3beat
Created November 18, 2015 07:09
Show Gist options
  • Save cod3beat/809de0a30868889c7dff to your computer and use it in GitHub Desktop.
Save cod3beat/809de0a30868889c7dff to your computer and use it in GitHub Desktop.
Event Mailer Service Provider
<?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');
}
}
// Contoh wujud dari ChallengeEventMailer
class ChallengeEventMailer extends EventListener
{
public function whenUnpublishedChallengeWasPublished($job, $data)
{
// jalankan tugas pengiriman email
}
public function whenUnpublishedChallengeWasCreated($job, $data)
{
}
// dsb
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment