$tags = Arr::get($webhookData, 'event-data.tags');
+
+
/** @todo check webhook key */
$this->batch_id = Str::after(Arr::first($tags, function($tag) {
return Str::startsWith($tag, 'batch_id_');
}), 'batch_id_');
+ \Log::info('batch ' . $this->batch_id);
+
$event = MailgunEvent::updateOrCreate([
'event' => Arr::get($webhookData, 'event-data.event'),
'recipient' => Arr::get($webhookData, 'event-data.recipient'),
'email_batch_id' => $this->batch_id
]);
- $this->broadcast = in_array(config('app.env'), $tags, true) &&
- ($event->wasRecentlyCreated);
-
- \Log::info("broadcast : " . ($this->broadcast ? "yes" : "no") . " " . config('app.env') . ' | ' . implode(',', $tags) . " | " );
+ $this->broadcast = ($event->wasRecentlyCreated);
$event->touch();