<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CommissionTransactions extends Model
{

    protected $table = 'commission_transactions';

    protected $fillable = [
        'wallet_id',
        'current_bal',
        'amount',
        'new_bal',
        'narration',
        'user_id',
        'order_id',
        'status',
    ];

    /**
     * Get the wallet that owns this transaction
     */
    public function wallet()
    {
        return $this->belongsTo(CommissionWallet::class, 'wallet_id');
    }

    /**
     * Get the user associated with this transaction
     */
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    /**
     * Get the order associated with this transaction
     */
    public function order()
    {
        return $this->belongsTo(Order::class, 'order_id');
    }

    public function ishareTransaction()
    {
        return $this->hasOne(IshareCommissionTransaction::class);
    }
}