'object'
];
protected $hidden = [
'withdraw_information'
];
public function user()
{
return $this->belongsTo(User::class);
}
public function scopeSuccess($query)
{
return $query->where('status', Status::PAYMENT_SUCCESS);
}
public function method()
{
return $this->belongsTo(WithdrawMethod::class, 'method_id');
}
public function statusBadge(): Attribute
{
return new Attribute(function(){
$html = '';
if($this->status == Status::PAYMENT_PENDING){
$html = ''.trans('Pending').'';
}elseif($this->status == Status::PAYMENT_SUCCESS){
$html = ''.trans('Approved').'
'.diffForHumans($this->updated_at).'';
}elseif($this->status == Status::PAYMENT_REJECT){
$html = ''.trans('Rejected').'
'.diffForHumans($this->updated_at).'';
}
return $html;
});
}
public function scopePending($query)
{
return $query->where('status', Status::PAYMENT_PENDING);
}
public function scopeApproved($query)
{
return $query->where('status', Status::PAYMENT_SUCCESS);
}
public function scopeRejected($query)
{
return $query->where('status', Status::PAYMENT_REJECT);
}
}