hasMany(RecoveryImage::class, 'order_id')->order(['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); } public function user(): HasOne { return $this->hasOne(User::class, 'user_id', 'user_id'); } public function shop(): HasOne { return $this->hasOne(Shop::class, 'shop_id', 'shop_id'); } public function recovery(): HasOne { return $this->hasOne(ServerRecovery::class, 'recovery_id', 'recovery_id'); } }