anonaddy/app/Models/OutboundMessage.php
2023-10-04 11:32:39 +01:00

63 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OutboundMessage extends Model
{
use HasFactory;
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'id',
'user_id',
'alias_id',
'recipient_id',
'email_type',
'bounced',
];
protected $casts = [
'id' => 'string',
'user_id' => 'string',
'alias_id' => 'string',
'recipient_id' => 'string',
'bounced' => 'boolean',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* Get the user for the outbound message.
*/
public function user()
{
return $this->belongsTo(User::class);
}
/**
* Get the recipient for the outbound message.
*/
public function recipient()
{
return $this->belongsTo(Recipient::class);
}
/**
* Get the alias for the outbound message.
*/
public function alias()
{
return $this->belongsTo(Alias::class);
}
public function markAsBounced()
{
$this->update(['bounced' => true]);
}
}