update api and add more features

This commit is contained in:
root
2026-06-04 02:24:41 -04:00
parent fa6c9519a0
commit 4e33882ac7
131 changed files with 34596 additions and 340 deletions
+61
View File
@@ -0,0 +1,61 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Records each reminder dispatched to parents for an open promotion
* record (see plan section 14).
*/
class PromotionReminderLog extends BaseModel
{
protected $table = 'promotion_reminders_log';
public $timestamps = true;
public const TYPE_FIRST = 'first';
public const TYPE_HALFWAY = 'halfway';
public const TYPE_FINAL = 'final';
public const TYPE_EXPIRATION = 'expiration';
public const TYPE_MANUAL = 'manual';
public const ALLOWED_TYPES = [
self::TYPE_FIRST,
self::TYPE_HALFWAY,
self::TYPE_FINAL,
self::TYPE_EXPIRATION,
self::TYPE_MANUAL,
];
protected $fillable = [
'promotion_id',
'student_id',
'parent_id',
'reminder_type',
'channel',
'subject',
'message',
'sent_at',
'sent_by',
];
protected $casts = [
'promotion_id' => 'integer',
'student_id' => 'integer',
'parent_id' => 'integer',
'sent_by' => 'integer',
'sent_at' => 'datetime',
];
public function promotion(): BelongsTo
{
return $this->belongsTo(StudentPromotionRecord::class, 'promotion_id', 'promotion_id');
}
public function scopeForPromotion(Builder $q, int $promotionId): Builder
{
return $q->where('promotion_id', $promotionId);
}
}