feat: [email] 테넌트 메일 설정 마이그레이션 및 모델 추가
- tenant_mail_configs 테이블 생성 (SMTP 설정, 브랜딩, 연결 테스트 결과) - mail_logs 테이블 생성 (발송 이력 추적) - TenantMailConfig, MailLog 모델 추가 (options JSON 정책 준수)
This commit is contained in:
47
app/Models/Tenants/MailLog.php
Normal file
47
app/Models/Tenants/MailLog.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user