update tests

This commit is contained in:
root
2026-06-08 22:06:30 -04:00
parent 79024235ef
commit 60ecacb7f8
54 changed files with 13243 additions and 5561 deletions
+33 -4
View File
@@ -3,6 +3,7 @@
namespace App\Models;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\SoftDeletes;
class Notification extends BaseModel
@@ -28,12 +29,40 @@ class Notification extends BaseModel
];
protected $casts = [
'scheduled_at' => 'datetime',
'expires_at' => 'datetime',
// If delivery_channels is JSON in DB:
'delivery_channels' => 'array',
'scheduled_at' => 'datetime',
'expires_at' => 'datetime',
];
/**
* MySQL stores channels as SET('in_app','email','sms'); expose as array in PHP.
*/
protected function deliveryChannels(): Attribute
{
return Attribute::make(
get: static function (?string $value): array {
if ($value === null || $value === '') {
return [];
}
$trimmed = trim($value);
if (str_starts_with($trimmed, '[')) {
$decoded = json_decode($trimmed, true);
return is_array($decoded) ? array_values($decoded) : [];
}
return array_values(array_filter(array_map('trim', explode(',', $value))));
},
set: static function ($value): string {
if (is_array($value)) {
return implode(',', array_values(array_filter(array_map('strval', $value))));
}
return (string) $value;
}
);
}
/**
* Equivalent of legacy getActiveNotifications()
* Active = scheduled_at <= now AND (expires_at is null OR expires_at > now)
+2 -2
View File
@@ -9,8 +9,8 @@ class PaymentTransaction extends BaseModel
{
protected $table = 'payment_transactions';
// ✅ legacy: useTimestamps = true (created_at/updated_at)
public $timestamps = true;
// Legacy table has no created_at/updated_at columns.
public $timestamps = false;
protected $fillable = [
'transaction_id',
+1 -1
View File
@@ -13,7 +13,7 @@ class StudentAllergy extends BaseModel
/**
* legacy: timestamps disabled
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'student_id',
+1 -1
View File
@@ -13,7 +13,7 @@ class StudentMedicalCondition extends BaseModel
/**
* legacy: timestamps disabled
*/
public $timestamps = true;
public $timestamps = false;
protected $fillable = [
'student_id',