62 lines
1.3 KiB
PHP
62 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Koneko\VuexyStoreManager\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Koneko\VuexyAdmin\Models\User;
|
|
|
|
class EmailTransaction extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'email_transactions';
|
|
protected $primaryKey = 'id';
|
|
public $incrementing = false;
|
|
protected $keyType = 'mediumint';
|
|
|
|
protected $fillable = [
|
|
'emailable_id',
|
|
'emailable_type',
|
|
'email_provider',
|
|
'smtp_server',
|
|
'smtp_port',
|
|
'smtp_username',
|
|
'subject',
|
|
'body',
|
|
'recipient',
|
|
'cc',
|
|
'bcc',
|
|
'reply_to',
|
|
'sender_name',
|
|
'sender_email',
|
|
'status',
|
|
'error_message',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'cc' => 'array',
|
|
'bcc' => 'array',
|
|
'status' => 'integer',
|
|
];
|
|
|
|
/**
|
|
* Relación polimórfica con modelos como pedidos, facturas, etc.
|
|
*/
|
|
public function emailable(): MorphTo
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
/**
|
|
* Relación con el usuario que creó el registro.
|
|
*/
|
|
public function createdBy(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
}
|