add hospital detail
This commit is contained in:
@@ -17,7 +17,7 @@ class HospitalResourceDetail extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
$querySpecialitys = PractitionerRole::query()
|
||||
->with('speciality')
|
||||
->with(['speciality'])
|
||||
->where('organization_id', $this->id)
|
||||
->whereNotNull('speciality_id')
|
||||
->orderBy('speciality_id')
|
||||
@@ -27,7 +27,7 @@ class HospitalResourceDetail extends JsonResource
|
||||
foreach ($querySpecialitys as $indexSpeciality => $speciality) {
|
||||
$specialitys[$indexSpeciality]['id'] = $speciality->speciality->id;
|
||||
$specialitys[$indexSpeciality]['name'] = $speciality->speciality->name;
|
||||
$specialitys[$indexSpeciality]['avatar'] = null;
|
||||
$specialitys[$indexSpeciality]['avatar'] = asset('images/default-specialisasi-image.png');
|
||||
}
|
||||
|
||||
if (empty($this->distance)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Modules\Linksehat\Transformers\Speciality;
|
||||
|
||||
use App\Models\Practice;
|
||||
use App\Helpers\Helper;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class SpecialityResource extends JsonResource
|
||||
@@ -15,13 +15,26 @@ class SpecialityResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
foreach ($this->practices as $practice) {
|
||||
if ($practice->service_code === 'walkin') {
|
||||
$practices[] = $practice->id;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->prices as $price) {
|
||||
if (in_array($price->priceable_id, $practices)) {
|
||||
$prices = $price->price_net;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'doctors' => [
|
||||
'id' => $this->practitioner->person->id,
|
||||
'name' => $this->practitioner->person->name,
|
||||
'specialis' => 'Spesialis ' . $this->speciality->name,
|
||||
'experience' => rand(5, 12),
|
||||
'rating' => rand(20, 100),
|
||||
'price' => '',
|
||||
'price' => Helper::currencyIdrFormat($prices),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user