api doctor detail

This commit is contained in:
Muhammad Fajar
2022-10-27 14:37:12 +07:00
parent 0ece467d21
commit 2f84f43ae5
11 changed files with 245 additions and 106 deletions

View File

@@ -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');