pay_statuses = collect([ collect(['key' => 1, 'value' => '未付款']), collect(['key' => 2, 'value' => '已付款']), collect(['key' => 3, 'value' => '已退款']), collect(['key' => 4, 'value' => '已取消']), collect(['key' => 5, 'value' => '回收站']), ]); } public function student() { return $this->belongsTo('App\Models\Student'); } public function getPayStatuses() { return $this->pay_statuses; } public function getStudentName() { return empty($this['student']) ? '' : $this['student']['name']; } public function getPayPosition() { return '落地页' . $this['pay_position'] . '付款'; } public function getPayStatusLabel() { switch($this['pay_status']) { case 1: return '未付款'; case 2: return '已付款'; case 3: return '已退款'; case 4: return '已取消'; case 5: return '回收站'; default: return '未付款'; } } public function getPayMethodLabel() { return '微信支付'; } public function getOutTradeNo() { return date('YmdHis') . rand(10, 99); } public function getPayMoney() { return round($this['money'] / 100, 2); } }