add tests batch 20

This commit is contained in:
root
2026-06-09 01:03:53 -04:00
parent 95efb9652e
commit 6be4875c5e
1502 changed files with 13797 additions and 11313 deletions
+24 -24
View File
@@ -3,6 +3,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class WhatsappInviteLog extends BaseModel
@@ -25,18 +26,17 @@ class WhatsappInviteLog extends BaseModel
];
protected $casts = [
'parent_id' => 'integer',
'parent_id' => 'integer',
'class_section_id' => 'integer',
'link_id' => 'integer',
'sent_at' => 'datetime',
'link_id' => 'integer',
'sent_at' => 'datetime',
];
/* ============================================================
* Status constants (optional but helpful)
* ============================================================
*/
public const STATUS_SENT = 'sent';
public const STATUS_SENT = 'sent';
public const STATUS_FAILED = 'failed';
/* ============================================================
@@ -103,13 +103,13 @@ class WhatsappInviteLog extends BaseModel
?int $linkId = null
): bool {
static::query()->create([
'parent_id' => $parentId,
'email' => $email,
'parent_id' => $parentId,
'email' => $email,
'class_section_id' => $classSectionId,
'link_id' => $linkId,
'status' => self::STATUS_SENT,
'error_message' => null,
'sent_at' => now(),
'link_id' => $linkId,
'status' => self::STATUS_SENT,
'error_message' => null,
'sent_at' => now(),
]);
return true;
@@ -126,13 +126,13 @@ class WhatsappInviteLog extends BaseModel
?int $linkId = null
): bool {
static::query()->create([
'parent_id' => $parentId,
'email' => $email,
'parent_id' => $parentId,
'email' => $email,
'class_section_id' => $classSectionId,
'link_id' => $linkId,
'status' => self::STATUS_FAILED,
'error_message' => $error,
'sent_at' => now(),
'link_id' => $linkId,
'status' => self::STATUS_FAILED,
'error_message' => $error,
'sent_at' => now(),
]);
return true;
@@ -167,13 +167,13 @@ class WhatsappInviteLog extends BaseModel
$req = $updating ? 'sometimes' : 'required';
return [
'parent_id' => [$req, 'integer', 'min:1'],
'email' => [$req, 'email', 'max:255'],
'status' => [$req, 'string', 'max:20'],
'parent_id' => [$req, 'integer', 'min:1'],
'email' => [$req, 'email', 'max:255'],
'status' => [$req, 'string', 'max:20'],
'class_section_id' => ['nullable', 'integer'],
'link_id' => ['nullable', 'integer'],
'error_message' => ['nullable', 'string', 'max:5000'],
'sent_at' => ['nullable', 'date'],
'link_id' => ['nullable', 'integer'],
'error_message' => ['nullable', 'string', 'max:5000'],
'sent_at' => ['nullable', 'date'],
];
}
}
}