add test batches

This commit is contained in:
root
2026-06-08 23:45:55 -04:00
parent c792b8be05
commit 8d4d610b82
1480 changed files with 22587 additions and 10762 deletions
+18 -17
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 ReimbursementBatchItem extends BaseModel
@@ -27,12 +28,12 @@ class ReimbursementBatchItem extends BaseModel
];
protected $casts = [
'batch_id' => 'integer',
'expense_id' => 'integer',
'batch_id' => 'integer',
'expense_id' => 'integer',
'reimbursement_id' => 'integer',
'admin_id' => 'integer',
'assigned_at' => 'datetime',
'unassigned_at' => 'datetime',
'admin_id' => 'integer',
'assigned_at' => 'datetime',
'unassigned_at' => 'datetime',
];
/* ============================================================
@@ -84,14 +85,14 @@ class ReimbursementBatchItem extends BaseModel
public function scopeAssigned(Builder $q): Builder
{
return $q->whereNotNull('admin_id')
->whereNotNull('assigned_at')
->whereNull('unassigned_at');
->whereNotNull('assigned_at')
->whereNull('unassigned_at');
}
public function scopeUnassigned(Builder $q): Builder
{
return $q->whereNull('admin_id')
->whereNull('assigned_at');
->whereNull('assigned_at');
}
/* ============================================================
@@ -136,15 +137,15 @@ class ReimbursementBatchItem extends BaseModel
public static function rules(bool $updating = false): array
{
return [
'batch_id' => [$updating ? 'sometimes' : 'required', 'integer', 'min:1', 'exists:reimbursement_batches,id'],
'expense_id' => ['nullable', 'integer', 'exists:expenses,id'],
'batch_id' => [$updating ? 'sometimes' : 'required', 'integer', 'min:1', 'exists:reimbursement_batches,id'],
'expense_id' => ['nullable', 'integer', 'exists:expenses,id'],
'reimbursement_id' => ['nullable', 'integer', 'exists:reimbursements,id'],
'admin_id' => ['nullable', 'integer'], // add exists rule if you know the table
'assigned_at' => ['nullable', 'date'],
'unassigned_at' => ['nullable', 'date', 'after_or_equal:assigned_at'],
'notes' => ['nullable', 'string', 'max:5000'],
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
'admin_id' => ['nullable', 'integer'], // add exists rule if you know the table
'assigned_at' => ['nullable', 'date'],
'unassigned_at' => ['nullable', 'date', 'after_or_equal:assigned_at'],
'notes' => ['nullable', 'string', 'max:5000'],
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
];
}
}
}