fix db tables to have school year
This commit is contained in:
@@ -18,18 +18,11 @@ class PaymentTransactionModel extends Model
|
||||
'payment_method',
|
||||
'payment_status',
|
||||
'transaction_fee',
|
||||
'payment_reference',
|
||||
'semester',
|
||||
'school_year',
|
||||
'is_full_payment', // Flag to track full payment status
|
||||
'created_at',
|
||||
'updated_at'
|
||||
'school_year'
|
||||
];
|
||||
|
||||
// Set automatic timestamps
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $useTimestamps = false;
|
||||
|
||||
// Validation rules
|
||||
protected $validationRules = [
|
||||
@@ -38,8 +31,8 @@ class PaymentTransactionModel extends Model
|
||||
'amount' => 'required|decimal',
|
||||
'payment_method' => 'required|string|max_length[50]',
|
||||
'payment_status' => 'required|string|max_length[50]',
|
||||
'payment_reference' => 'permit_empty|string|max_length[255]',
|
||||
'is_full_payment' => 'required|in_list[0,1]', // 0 for installment, 1 for full payment
|
||||
'semester' => 'permit_empty|string|max_length[30]',
|
||||
'school_year' => 'permit_empty|string|max_length[9]',
|
||||
];
|
||||
|
||||
// Custom error messages
|
||||
@@ -64,13 +57,6 @@ class PaymentTransactionModel extends Model
|
||||
'required' => 'The payment status is required.',
|
||||
'max_length' => 'The payment status must not exceed 50 characters.',
|
||||
],
|
||||
'payment_reference' => [
|
||||
'max_length' => 'The payment reference must not exceed 255 characters.',
|
||||
],
|
||||
'is_full_payment' => [
|
||||
'required' => 'The full payment flag is required.',
|
||||
'in_list' => 'The full payment flag must be either 0 (installment) or 1 (full payment).',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -106,7 +92,9 @@ class PaymentTransactionModel extends Model
|
||||
*/
|
||||
public function updateTransactionStatus($transactionId, $status)
|
||||
{
|
||||
return $this->update($transactionId, ['payment_status' => $status]);
|
||||
return $this->where('transaction_id', $transactionId)
|
||||
->set(['payment_status' => $status])
|
||||
->update();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +118,9 @@ class PaymentTransactionModel extends Model
|
||||
*/
|
||||
public function updateTransactionFee($transactionId, $transactionFee)
|
||||
{
|
||||
return $this->update($transactionId, ['transaction_fee' => $transactionFee]);
|
||||
return $this->where('transaction_id', $transactionId)
|
||||
->set(['transaction_fee' => $transactionFee])
|
||||
->update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user