12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace App\Models;
- use App\Enums\TechnicianAuthStatus;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Slowlyo\OwlAdmin\Models\BaseModel as Model;
- /**
- * 技师信息记录
- */
- class CoachInfoRecord extends Model
- {
- use SoftDeletes;
- protected $table = 'coach_info_records';
- protected $guarded = [];
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'portrait_images' => 'array',
- ];
- /**
- * 应该被追加到模型数组的访问器
- *
- * @var array
- */
- protected $appends = ['state_text'];
- /**
- * 获取状态文本
- */
- public function getStateTextAttribute(): string
- {
- return TechnicianAuthStatus::fromValue($this->state)?->label() ?? '未知状态';
- }
- /**
- * @Author FelixYin
- * @description 信息记录所属技师
- */
- public function coach()
- {
- return $this->belongsTo('App\Models\CoachUser', 'coach_id');
- }
- }
|