|
@@ -39,7 +39,7 @@ class CoachInfoRecord extends Model
|
|
|
*/
|
|
|
public function getStateTextAttribute(): string
|
|
|
{
|
|
|
- return TechnicianAuthStatus::fromValue($this->state)?->label() ?? '未知状态';
|
|
|
+ return $this->state && TechnicianAuthStatus::fromValue($this->state)?->label() ?? '未知状态';
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -50,4 +50,9 @@ class CoachInfoRecord extends Model
|
|
|
{
|
|
|
return $this->belongsTo(CoachUser::class, 'coach_id', 'id');
|
|
|
}
|
|
|
+
|
|
|
+ public function getStateAttribute($value)
|
|
|
+ {
|
|
|
+ return $value !== null ? TechnicianAuthStatus::fromValue($value) : null;
|
|
|
+ }
|
|
|
}
|