46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
class PaypalTransaction extends BaseModel
|
|
{
|
|
protected $table = 'paypal_transactions';
|
|
|
|
// ✅ CI: useTimestamps = true (created_at/updated_at)
|
|
public $timestamps = true;
|
|
|
|
protected $fillable = [
|
|
'transaction_id',
|
|
'payment_id',
|
|
'firstname',
|
|
'lastname',
|
|
'event_type',
|
|
'payer_email',
|
|
'amount',
|
|
'currency',
|
|
'status',
|
|
'payment_method',
|
|
'transaction_fee',
|
|
'raw_data',
|
|
'created_at',
|
|
'updated_at',
|
|
'school_year',
|
|
'semester',
|
|
];
|
|
|
|
protected $casts = [
|
|
'payment_id' => 'integer',
|
|
'amount' => 'decimal:2', // adjust precision if needed
|
|
'transaction_fee' => 'decimal:2', // adjust precision if needed
|
|
// raw_data is often JSON; if it's JSON in DB, cast to array
|
|
'raw_data' => 'array',
|
|
];
|
|
|
|
/* Optional relationship */
|
|
public function payment()
|
|
{
|
|
return $this->belongsTo(Payment::class, 'payment_id');
|
|
}
|
|
} |