remove codeigniter
This commit is contained in:
@@ -10,7 +10,7 @@ class DiscountVoucher extends BaseModel
|
||||
{
|
||||
protected $table = 'discount_vouchers';
|
||||
|
||||
// ✅ CI manages created_at / updated_at
|
||||
// ✅ legacy manages created_at / updated_at
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
@@ -39,7 +39,7 @@ class DiscountVoucher extends BaseModel
|
||||
];
|
||||
|
||||
/* =========================
|
||||
* Model hooks (CI beforeInsert/beforeUpdate equivalents)
|
||||
* Model hooks (legacy beforeInsert/beforeUpdate equivalents)
|
||||
* ========================= */
|
||||
|
||||
protected static function booted(): void
|
||||
@@ -95,7 +95,7 @@ class DiscountVoucher extends BaseModel
|
||||
$until = Carbon::parse($this->valid_until)->toDateString();
|
||||
if ($from > $until) {
|
||||
// In Laravel, prefer validating in FormRequest.
|
||||
// This keeps your CI behavior by failing the save.
|
||||
// This keeps your legacy behavior by failing the save.
|
||||
throw new \InvalidArgumentException('Valid Until must be the same as or after Valid From.');
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class DiscountVoucher extends BaseModel
|
||||
/**
|
||||
* Find a valid voucher for a student (not expired, active, under max uses, and not used by the student).
|
||||
*
|
||||
* NOTE: Your CI joins discount_usages on u.student_id. That requires discount_usages.student_id to exist.
|
||||
* NOTE: Your legacy joins discount_usages on u.student_id. That requires discount_usages.student_id to exist.
|
||||
* If your discount_usages table does NOT have student_id (some of your other code uses parent_id),
|
||||
* switch the filter to parent_id instead.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user