Files
mtdb_movie/common/Logging/Mail/OutgoingEmailLogItem.php
maher 703f50a09d
Some checks failed
Build / run (push) Has been cancelled
first commit
2025-10-29 11:42:25 +01:00

56 lines
1.2 KiB
PHP
Executable File

<?php
namespace Common\Logging\Mail;
use Common\Core\BaseModel;
use Illuminate\Database\Eloquent\Casts\Attribute;
class OutgoingEmailLogItem extends BaseModel
{
const MODEL_TYPE = 'outgoing_email_log_item';
protected $table = 'outgoing_email_log';
protected $guarded = ['id'];
protected $casts = [
'id' => 'integer',
];
protected $hidden = ['mime'];
protected function mime(): Attribute
{
return Attribute::make(get: fn(string $value) => utf8_decode($value));
}
public static function filterableFields(): array
{
return ['id', 'status', 'from', 'to', 'created_at'];
}
public function toNormalizedArray(): array
{
return [
'id' => $this->id,
'name' => $this->subject,
'description' => $this->message_id,
'model_type' => self::MODEL_TYPE,
];
}
public function toSearchableArray(): array
{
return [
'id' => $this->id,
'subject' => $this->subject,
'to' => $this->to,
];
}
public static function getModelTypeAttribute(): string
{
return self::MODEL_TYPE;
}
}