reconstruction of the project
This commit is contained in:
+29
-10
@@ -6,8 +6,11 @@ use App\Models\BaseModel;
|
||||
|
||||
class PaymentError extends BaseModel
|
||||
{
|
||||
protected $table = 'payment_error'; // The DB table
|
||||
protected $primaryKey = 'id'; // Primary key
|
||||
protected $table = 'payment_error';
|
||||
|
||||
// CI: useTimestamps = false (logged_at managed manually)
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'payment_id',
|
||||
'invoice_id',
|
||||
@@ -22,12 +25,28 @@ class PaymentError extends BaseModel
|
||||
'semester',
|
||||
];
|
||||
|
||||
public $timestamps = false; // We'll manage logged_at manually
|
||||
protected $validationRules = [
|
||||
'wrong_paid_amount' => 'required|decimal',
|
||||
'payment_id' => 'required|integer',
|
||||
'invoice_id' => 'required|integer',
|
||||
'parent_id' => 'required|integer'
|
||||
];
|
||||
protected $casts = [
|
||||
'payment_id' => 'integer',
|
||||
'invoice_id' => 'integer',
|
||||
'parent_id' => 'integer',
|
||||
'wrong_paid_amount' => 'decimal:2', // adjust precision if needed
|
||||
'logged_by' => 'integer',
|
||||
'logged_at' => 'datetime',
|
||||
];
|
||||
|
||||
}
|
||||
/* Optional relationships */
|
||||
public function invoice()
|
||||
{
|
||||
return $this->belongsTo(Invoice::class, 'invoice_id');
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function logger()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'logged_by');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user