123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace App\Models;
- use App\Enums\TechnicianLevel;
- use App\Enums\TechnicianStatus;
- use App\Enums\TechnicianWorkStatus;
- use Illuminate\Database\Eloquent\Model;
- class VCoachList extends Model
- {
- protected $table = 'v_coach_list';
- public $timestamps = false;
- protected $casts = [
- 'id' => 'integer',
- 'gender' => 'integer',
- 'birthday' => 'datetime',
- 'created_at' => 'datetime',
- 'state' => 'integer',
- 'is_vip' => 'integer',
- 'vip_time' => 'timestamp',
- 'level' => 'integer',
- 'score' => 'float',
- 'work_status' => 'integer',
- 'virtual_order' => 'integer',
- 'total_income' => 'decimal:2',
- 'total_expense' => 'decimal:2',
- 'total_balance' => 'decimal:2',
- 'available_balance' => 'decimal:2',
- 'frozen_amount' => 'decimal:2',
- 'avatar' => 'array',
- 'qual_photo' => 'array',
- 'business_license' => 'array',
- 'health_certificate' => 'array',
- 'id_card_front_photo' => 'array',
- 'id_card_back_photo' => 'array',
- 'formal_photo' => 'string',
- 'health_cert' => 'array',
- ];
- protected $appends = [
- 'state_text',
- 'level_text',
- 'work_status_text',
- ];
- public function getStateTextAttribute()
- {
- return is_null($this->state) ? null : TechnicianStatus::fromValue($this->state)?->label();
- }
- public function getLevelTextAttribute()
- {
- return is_null($this->level) ? null : TechnicianLevel::fromValue($this->level)?->label();
- }
- public function getWorkStatusTextAttribute()
- {
- return is_null($this->work_status) ? null : TechnicianWorkStatus::fromValue($this->work_status)?->label();
- }
- }
|