hasMany(RecoveryImage::class, 'order_id', 'order_id')->order(['id']); } public function recovery() { $this->hasOne(ServerRecovery::class, 'recovery_id', 'recovery_id'); } public function getOrderStatusTextAttr($value, $data) { $result = RecoveryStatusEnum::data(); if (!empty($result[$data['order_status']]['name'])) { return $result[$data['order_status']]['name']; } return '未知'; } public function getRecoveryTypeTextAttr($value, $data) { $result = RecoveryTypeEnum::data(); if (!empty($result[$data['recovery_type']]['name'])) { return $result[$data['recovery_type']]['name']; } return '未知'; } /** * @notes:详情 * @param $where * @param array $with * @return RecoveryOrder|array|null * @author: wanghousheng */ public static function detail($where, array $with = []) { return static::get($where, $with); } }