abort(200);
}
- $event = MailgunEvent::updateOrCreate([
+ $event = MailgunEvent::query()->updateOrCreate([
'event' => Arr::get($webhookData, 'event-data.event'),
'recipient' => Arr::get($webhookData, 'event-data.recipient'),
- 'email_batch_id' => $this->batch_id
+ 'email_batch_id' => $this->batch_id,
+ ], [
+ 'status' => Arr::get($webhookData, 'event-data.delivery-status')
]);
$this->broadcast = ($event->wasRecentlyCreated);
* Class MailgunEvent
* @package App
* @property EmailBatch $batch
- * @method static MailgunEvent updateOrCreate(array $arr, array $values = [])
*/
class MailgunEvent extends Model
{
protected $guarded = [];
+ protected $casts = [
+ 'status' => 'array'
+ ];
+
/**
* @return BelongsTo
--- /dev/null
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddDataToMailgunEvents extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('mailgun_events', function (Blueprint $table) {
+ $table->json('status')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('mailgun_events', function (Blueprint $table) {
+ $table->dropColumn('status');
+ });
+ }
+}