55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Fillable([
|
|
'sms_campaign_id',
|
|
'contact_id',
|
|
'contact_phone_number_id',
|
|
'contact_name',
|
|
'number',
|
|
'status',
|
|
'provider_message_id',
|
|
'provider_response',
|
|
'error_message',
|
|
'sent_at',
|
|
])]
|
|
class SmsDelivery extends Model
|
|
{
|
|
/**
|
|
* @return BelongsTo<SmsCampaign, $this>
|
|
*/
|
|
public function campaign(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SmsCampaign::class, 'sms_campaign_id');
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<Contact, $this>
|
|
*/
|
|
public function contact(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Contact::class);
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<ContactPhoneNumber, $this>
|
|
*/
|
|
public function phoneNumber(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ContactPhoneNumber::class, 'contact_phone_number_id');
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'provider_response' => 'array',
|
|
'sent_at' => 'datetime',
|
|
];
|
|
}
|
|
}
|