Files
sam-api/app/Models/Tenants/MailLog.php
김보곤 918ae0ebc1 feat: [email] 테넌트 메일 설정 마이그레이션 및 모델 추가
- tenant_mail_configs 테이블 생성 (SMTP 설정, 브랜딩, 연결 테스트 결과)
- mail_logs 테이블 생성 (발송 이력 추적)
- TenantMailConfig, MailLog 모델 추가 (options JSON 정책 준수)
2026-03-12 07:42:06 +09:00

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;
}
}