api doctor detail
This commit is contained in:
@@ -27,7 +27,7 @@ class Organization extends Model
|
||||
public $appends = [
|
||||
'meta'
|
||||
];
|
||||
|
||||
|
||||
public function setCodeAttribute($value)
|
||||
{
|
||||
$this->attributes['code'] = !empty($value) ? $value : Str::upper(Str::random('6'));
|
||||
|
||||
@@ -18,6 +18,25 @@ class Practice extends Model
|
||||
'deleted_by'
|
||||
];
|
||||
|
||||
// public $appends = [
|
||||
// 'price'
|
||||
// ];
|
||||
|
||||
// public function getPriceAttribute()
|
||||
// {
|
||||
// $orgPrice = [];
|
||||
// foreach ($this->prices as $price) {
|
||||
// $orgPrice[$this->service_code] = $price->price_net;
|
||||
// }
|
||||
|
||||
// return $orgPrice;
|
||||
// }
|
||||
|
||||
public function getPriceAttribute()
|
||||
{
|
||||
return $this->prices->where('priceable_id', $this->id)->max('price_net');
|
||||
}
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->morphMany(Price::class, 'priceable');
|
||||
|
||||
@@ -39,39 +39,6 @@ class PractitionerRole extends Model
|
||||
return $this->practices->where('service_code', 'instant-chat')->where('active', 1)->count() >= 1;
|
||||
}
|
||||
|
||||
public function getDailyAvailabilitiesAttribute()
|
||||
{
|
||||
$schedules = [
|
||||
'Senin' => [],
|
||||
'Selasa' => [],
|
||||
'Rabu' => [],
|
||||
'Kamis' => [],
|
||||
'Jumat' => [],
|
||||
'Sabtu' => [],
|
||||
'Minggu' => []
|
||||
];
|
||||
|
||||
foreach ($this->availabilities as $availability) {
|
||||
|
||||
if (count($availability->days)) {
|
||||
|
||||
foreach ($availability->days as $day) {
|
||||
$schedules[$day][] = $availability->start_time;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
foreach ($schedules as $day => $times) {
|
||||
$schedules[$day][] = $availability->start_time;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $schedules;
|
||||
}
|
||||
|
||||
public function metas()
|
||||
{
|
||||
return $this->morphMany(Meta::class, 'metaable');
|
||||
|
||||
Reference in New Issue
Block a user