Tuesday 7 July 2020

Laravel Mass Mailer

Kita dapat memamanfaatkan Illuminate\Support\Facades\Notification.


class Pembayaran extends Model
{
    use Notifiable;

    protected $table = 'pembayarans';
    ...
 
   public function prosesVerifikasi($user_id, $jadwal_id, $is_terverifikasi, $created_by, $catatan) {
   ... 
  $pembayaran = Pembayaran::where('user_id', $user_id)
         ->where('jadwal_id', $jadwal_id)->first();
         Notification::send($pembayaran, new PaymentVerified($is_terverifikasi, $catatan, $jadwal_id));
  ....
  }
  ....
}

Referensi

  1. Your Guide to Laravel Email Queues, https://blog.mailtrap.io/laravel-mail-queue/