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'
- ];
-
- public function coach()
- {
- return $this->belongsTo(CoachUser::class, 'coach_id', 'id');
- }
-
- public function getQualPhotoUrlAttribute(): ?string
- {
- return $this->qual_photo
- ? "/api/download?filename={$this->qual_photo}&bucket=user-avatar"
- : null;
- }
-
- public function getBusinessLicenseUrlAttribute(): ?string
- {
- return $this->business_license
- ? "/api/download?filename={$this->business_license}&bucket=user-avatar"
- : null;
- }
-
- public function getHealthCertificateUrlAttribute(): ?string
- {
- return $this->health_certificate
- ? "/api/download?filename={$this->health_certificate}&bucket=user-avatar"
- : null;
- }
- }
|