belongsTo(User::class); } public function dealer() { return $this->belongsTo(Dealer::class, 'user_id', 'user_id'); } /** * 待打款状态 * * @return boolean */ public function isPending() { return $this->status == self::STATUS_PENDING; } /** * 获取用户的打款信息 * * @return void */ public function getPayInfo() { if ($this->isPending()) {//待打款订单显示发货人收款信息 $payInfo = $this->user->dealer->pay_info; } else { $payInfo = $this->pay_info; } return $payInfo ?: null; } }