46 lines
923 B
PHP
46 lines
923 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Fillable([
|
|
'calendar_event_id',
|
|
'sms_campaign_id',
|
|
'reminder_key',
|
|
'action',
|
|
'trigger_minutes',
|
|
'remind_at',
|
|
'status',
|
|
'last_error',
|
|
'sent_at',
|
|
])]
|
|
class CalendarReminder extends Model
|
|
{
|
|
/**
|
|
* @return BelongsTo<CalendarEvent, $this>
|
|
*/
|
|
public function event(): BelongsTo
|
|
{
|
|
return $this->belongsTo(CalendarEvent::class, 'calendar_event_id');
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<SmsCampaign, $this>
|
|
*/
|
|
public function smsCampaign(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SmsCampaign::class);
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'remind_at' => 'datetime',
|
|
'sent_at' => 'datetime',
|
|
];
|
|
}
|
|
}
|