DealerWalletToBankLogStatus::class, ]; /** * @var array */ protected $fillable = [ 'user_id', 'amount', 'status', 'remarks', 'rate', 'service_amount', 'account_amount', ]; /** * 提现记录所属用户 * */ public function user() { return $this->belongsTo(User::class); } public function dealer() { return $this->belongsTo(Dealer::class, 'user_id', 'user_id'); } /** * 待打款状态 * * @return boolean */ public function isPending() { return $this->status === DealerWalletToBankLogStatus::Pending; } /** * 获取用户的打款信息 * * @return void */ public function getPayInfo() { if ($this->isPending()) {//待打款订单显示发货人收款信息 $payInfo = $this->user->dealer->pay_info; } else { $payInfo = $this->pay_info; } return $payInfo ?: null; } }