57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\WalletTransactionReasonEnum;
|
|
use App\Enums\WalletTransactionTypeEnum;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class WalletTransaction extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'type',
|
|
'reason',
|
|
'amount',
|
|
'balance_after',
|
|
'description',
|
|
'wallet_id',
|
|
'invoice_id',
|
|
'payment_id',
|
|
'withdraw_request_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'type' => WalletTransactionTypeEnum::class,
|
|
'reason' => WalletTransactionReasonEnum::class,
|
|
'amount' => 'integer',
|
|
'balance_after' => 'integer',
|
|
'wallet_id' => 'integer',
|
|
'invoice_id' => 'integer',
|
|
'payment_id' => 'integer',
|
|
'withdraw_request_id' => 'integer',
|
|
];
|
|
|
|
public function wallet()
|
|
{
|
|
return $this->belongsTo(Wallet::class);
|
|
}
|
|
|
|
public function invoice()
|
|
{
|
|
return $this->belongsTo(Invoice::class);
|
|
}
|
|
|
|
public function payment()
|
|
{
|
|
return $this->belongsTo(Payment::class);
|
|
}
|
|
|
|
public function withdrawRequest()
|
|
{
|
|
return $this->belongsTo(WithdrawRequest::class);
|
|
}
|
|
}
|