'json', 'fee_file_ids' => 'json', 'data' => 'json', 'change_data' => 'json']; protected $appends = ['files', 'fee_files', 'status_text', 'fee_status_text']; public static $intToString = [ 'status' => [ 0 => '待审核', 1 => '审核通过', 2 => '审核不通过', 3 => '备选', 4 => '已取消', 5 => '主动放弃', 6 => '黑名单' ], 'fee_status' => [ 0 => '未缴费', 1 => '缴费成功', 2 => '缴费失败', 3 => '待确认' ], ]; public function getStatusTextAttribute($value) { return self::$intToString['status'][$this->status] ?? ''; } public function getFeeStatusTextAttribute($value) { return self::$intToString['fee_status'][$this->fee_status] ?? ''; } public function getFilesAttribute($value) { if (empty($this->file_ids)) return []; return Upload::whereIn('id', $this->file_ids)->get(); } public function getFeeFilesAttribute($value) { if (empty($this->fee_file_ids)) return []; return Upload::whereIn('id', $this->fee_file_ids)->get(); } public function course() { return $this->hasOne(Course::class, 'id', 'course_id'); } public function user() { return $this->hasOne(User::class, 'id', 'user_id'); } /** * 第三方日志记录 * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function thirdAppointmentLogs() { return $this->hasMany(ThirdAppointmentLog::class, 'course_sign_id', 'id'); } }