Update Doctor Resource

This commit is contained in:
R
2022-09-23 08:36:30 +07:00
parent a67afc27b6
commit 5fe1dc4bc6
36 changed files with 92181 additions and 15 deletions

View File

@@ -18,6 +18,26 @@ class PractitionerRole extends Model
'period_end',
'active',
];
public function getIsChatAvailableAttribute()
{
return $this->practices->where('service_code', 'chat')->where('active', 1)->count() >= 1;
}
public function getIsWalkinAvailableAttribute()
{
return $this->practices->where('service_code', 'walkin')->where('active', 1)->count() >= 1;
}
public function getIsVideoAvailableAttribute()
{
return $this->practices->where('service_code', 'video')->where('active', 1)->count() >= 1;
}
public function getIsInstantChatAvailableAttribute()
{
return $this->practices->where('service_code', 'instant-chat')->where('active', 1)->count() >= 1;
}
public function metas()
{
@@ -38,4 +58,14 @@ class PractitionerRole extends Model
{
return $this->belongsTo(Speciality::class, 'speciality_id');
}
public function practices()
{
return $this->hasMany(Practice::class, 'practitioner_role_id');
}
public function availabilities()
{
return $this->hasMany(PractitionerRoleAvailability::class, 'practitioner_role_id');
}
}