48 lines
984 B
PHP
48 lines
984 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Tenants;
|
||
|
|
|
||
|
|
use App\Traits\BelongsToTenant;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class MailLog extends Model
|
||
|
|
{
|
||
|
|
use BelongsToTenant;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'tenant_id',
|
||
|
|
'mailable_type',
|
||
|
|
'to_address',
|
||
|
|
'from_address',
|
||
|
|
'subject',
|
||
|
|
'status',
|
||
|
|
'sent_at',
|
||
|
|
'options',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'sent_at' => 'datetime',
|
||
|
|
'options' => 'array',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function tenant(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Tenant::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getOption(string $key, mixed $default = null): mixed
|
||
|
|
{
|
||
|
|
return data_get($this->options, $key, $default);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function setOption(string $key, mixed $value): static
|
||
|
|
{
|
||
|
|
$options = $this->options ?? [];
|
||
|
|
data_set($options, $key, $value);
|
||
|
|
$this->options = $options;
|
||
|
|
|
||
|
|
return $this;
|
||
|
|
}
|
||
|
|
}
|