Skip to content

Commit

Permalink
Cast event to enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Sep 8, 2024
1 parent 6fb629f commit 90e04fa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Models/MailEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

namespace Vormkracht10\Mails\Models;

use Illuminate\Support\Str;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Model;
use Vormkracht10\Mails\Enums\EventType;
use Vormkracht10\Mails\Events\MailEventLogged;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use Vormkracht10\Mails\Database\Factories\MailEventFactory;
use Vormkracht10\Mails\Events\MailEventLogged;

/**
* @property Mail $mail
* @property string $type
* @property EventType $type
* @property string $ip_address
* @property string $hostname
* @property string $platform
Expand Down Expand Up @@ -50,6 +51,7 @@ class MailEvent extends Model
];

protected $casts = [
'type' => EventType::class,
'payload' => 'object',
'created_at' => 'datetime',
'occurred_at' => 'datetime',
Expand Down Expand Up @@ -85,6 +87,6 @@ public function mail()

protected function getEventClassAttribute(): string
{
return 'Vormkracht10\Mails\Events\Mail'.Str::studly($this->type);
return 'Vormkracht10\Mails\Events\Mail' . Str::studly($this->type);
}
}
}

0 comments on commit 90e04fa

Please sign in to comment.