12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Models;
- use App\Enums\TechnicianAuthStatus;
- use App\Traits\HasStateText;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Slowlyo\OwlAdmin\Models\BaseModel as Model;
- /**
- * 技师资质认证记录
- */
- class CoachQualRecord extends Model
- {
- use HasStateText, SoftDeletes;
- protected $table = 'coach_qual_records';
- protected $guarded = [];
- /**
- * 状态枚举类
- */
- protected string $stateEnumClass = TechnicianAuthStatus::class;
- protected $appends = [
- 'qual_photo_url', // 从业资格证
- 'business_license_url', // 营业执照
- 'health_certificate_url' // 健康证
- ];
- /**
- * @Author FelixYin
- * @description 资质记录所属技师
- */
- public function coach()
- {
- return $this->belongsTo(CoachUser::class, 'coach_id', 'id');
- }
- /**
- * 获取从业资格证完整URL
- */
- public function getQualPhotoUrlAttribute(): ?string
- {
- return $this->qual_photo
- ? "/api/download?filename={$this->qual_photo}&bucket=user-avatar"
- : null;
- }
- /**
- * 获取营业执照完整URL
- */
- public function getBusinessLicenseUrlAttribute(): ?string
- {
- return $this->business_license
- ? "/api/download?filename={$this->business_license}&bucket=user-avatar"
- : null;
- }
- /**
- * 获取健康证完整URL
- */
- public function getHealthCertificateUrlAttribute(): ?string
- {
- return $this->health_certificate
- ? "/api/download?filename={$this->health_certificate}&bucket=user-avatar"
- : null;
- }
- }
|