<?php

// app/Models/Withdraw.php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Withdraw extends Model
{
    protected $fillable = [
        'user_id',
        'method_id',
        'type_id',
        'number',
        'amount',
        'charge',
        'total',
        'transaction_id',
        'status',
    ];


    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function method()
    {
        return $this->belongsTo(WithdrawMethod::class);
    }

    public function type()
    {
        return $this->belongsTo(WithdrawType::class);
    }

    public function histories()
    {
        return $this->hasMany(WithdrawHistory::class)->latest();
    }
}
