Update Doctor Resource
This commit is contained in:
@@ -80,6 +80,8 @@ class DoctorController extends Controller
|
||||
'practitionerRoles.metas',
|
||||
'practitionerRoles.speciality',
|
||||
'practitionerRoles.organization',
|
||||
'practitionerRoles.practices',
|
||||
'practitionerRoles.availabilities',
|
||||
'person',
|
||||
'metas',
|
||||
])
|
||||
|
||||
@@ -29,10 +29,10 @@ Route::prefix('linksehat')->group(function () {
|
||||
Route::get('hospitals', [HospitalController::class, 'index']);
|
||||
Route::get('hospitals/{id}', [HospitalController::class, 'show']);
|
||||
|
||||
Route::get('doctors/online', [DoctorController::class, 'index']);
|
||||
Route::get('doctors', [DoctorController::class, 'index']);
|
||||
Route::get('doctors/{id}', [DoctorController::class, 'show']);
|
||||
Route::get('doctors/{id}/schedule', [DoctorController::class, 'schedule']);
|
||||
Route::get('doctors/online', [DoctorController::class, 'index'])->name('doctors.online');
|
||||
Route::get('doctors', [DoctorController::class, 'index'])->name('doctors.index');
|
||||
Route::get('doctors/{id}', [DoctorController::class, 'show'])->name('doctors.show');
|
||||
Route::get('doctors/{id}/schedule', [DoctorController::class, 'schedule'])->name('doctors.schedule');
|
||||
|
||||
// Route::middleware('auth:api')->get('/linksehat', function (Request $request) {
|
||||
// return $request->user();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Modules\Linksehat\Transformers;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class DoctorResource extends JsonResource
|
||||
{
|
||||
@@ -21,7 +22,12 @@ class DoctorResource extends JsonResource
|
||||
'hospital_id' => $practitionerRole->organization_id,
|
||||
'speciality_id' => $practitionerRole->speciality_id,
|
||||
'hospital' => HospitalResource::make($practitionerRole->organization),
|
||||
'speciality' => SpecialityResource::make($practitionerRole->speciality)
|
||||
'speciality' => SpecialityResource::make($practitionerRole->speciality),
|
||||
|
||||
'is_chat_available' => $practitionerRole->is_chat_available,
|
||||
'is_video_available' => $practitionerRole->is_video_available,
|
||||
'is_walkin_available' => $practitionerRole->is_walkin_available,
|
||||
'is_instant_chat_available' => $practitionerRole->is_instant_chat_available,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -32,12 +38,12 @@ class DoctorResource extends JsonResource
|
||||
'name' => $this->person->name ?? null,
|
||||
'name_suffix' => $this->person->name_suffix ?? null,
|
||||
'gender' => $this->person->gender ?? null,
|
||||
// 'speciality_name' => !empty($this->speciality->name ?? null) ? 'Spesialis '. $this->speciality->name : 'Spesialis Empty',
|
||||
'is_online' => false,
|
||||
'is_insurance_covered' => rand(0,1) == 1,
|
||||
// 'price_range' => 'Rp 100.000 - Rp 350.000',
|
||||
// 'price_start' => '100000',
|
||||
// 'price_end' => '350000',
|
||||
'price_range' => 'Rp 100.000 - Rp 350.000',
|
||||
'price_start' => '100000',
|
||||
'price_end' => '350000',
|
||||
'currency' => 'IDR',
|
||||
'avatar_url' => asset('images/default-doctor-avatar.png'),
|
||||
'education' => $this->meta->education ?? '',
|
||||
'medical_treatment' => $this->meta->medical_treatment ?? '',
|
||||
@@ -45,7 +51,8 @@ class DoctorResource extends JsonResource
|
||||
'work_experience' => $this->meta->work_experience ?? '',
|
||||
'keilmuan' => $this->meta->keilmuan ?? '',
|
||||
'description' => $this->meta->description ?? '',
|
||||
'practices' => $practices
|
||||
'practices' => $practices,
|
||||
'rating' => rand(350, 500) / 10,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@ class HospitalResource extends JsonResource
|
||||
'address' => $this->currentAddress->text ?? null,
|
||||
'lat' => $this->currentAddress->lat ?? null,
|
||||
'lng' => $this->currentAddress->lng ?? null,
|
||||
'distance' => isset($this->distance_km) ? round($this->distance_km) . ' km' : '-',
|
||||
'city_name' => 'Kota Tangerang',
|
||||
'distance' => isset($this->distance_km) ? round($this->distance_km) . ' km' : null,
|
||||
'city_name' => $this->currentAddress->city->name ?? null,
|
||||
'rating' => rand(350, 500) / 10,
|
||||
'phone' => $this->meta->phone,
|
||||
'photo_url' => asset('images/default-hospital-image.png'),
|
||||
'photos' => [
|
||||
|
||||
@@ -27,6 +27,7 @@ class PractitionerRoleToDoctorDetailResource extends JsonResource
|
||||
'price_range' => 'Rp 100.000 - Rp 350.000',
|
||||
'price_start' => '100000',
|
||||
'price_end' => '350000',
|
||||
'currency' => 'IDR',
|
||||
'avatar_url' => asset('images/default-doctor-avatar.png'),
|
||||
'education' => $this->meta->education ?? '',
|
||||
'medical_treatment' => $this->meta->medical_treatment ?? '',
|
||||
@@ -34,6 +35,12 @@ class PractitionerRoleToDoctorDetailResource extends JsonResource
|
||||
'work_experience' => $this->meta->work_experience ?? '',
|
||||
'keilmuan' => $this->meta->keilmuan ?? '',
|
||||
'description' => $this->meta->description ?? '',
|
||||
'rating' => rand(350, 500) / 10,
|
||||
|
||||
'is_chat_available' => $this->is_chat_available,
|
||||
'is_video_available' => $this->is_video_available,
|
||||
'is_walkin_available' => $this->is_walkin_available,
|
||||
'is_instant_chat_available' => $this->is_instant_chat_available,
|
||||
];
|
||||
|
||||
return parent::toArray($request);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Modules\Linksehat\Transformers;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Route;
|
||||
|
||||
class PractitionerRoleToDoctorResource extends JsonResource
|
||||
{
|
||||
@@ -41,14 +42,21 @@ class PractitionerRoleToDoctorResource extends JsonResource
|
||||
'name_suffix' => $this->practitioner->person->name_suffix,
|
||||
'gender' => $this->practitioner->person->gender,
|
||||
// 'speciality_name' => !empty($this->speciality->name ?? null) ? 'Spesialis '. $this->speciality->name : 'Spesialis Empty',
|
||||
'is_online' => false,
|
||||
'is_insurance_covered' => rand(0,1) == 1,
|
||||
'is_online' => Route::getCurrentRoute()->action['as'] == 'doctors.online',
|
||||
'is_insurance_covered' => (rand(0,1) == 1),
|
||||
'price_range' => 'Rp 100.000 - Rp 350.000',
|
||||
'price_start' => '100000',
|
||||
'price_end' => '350000',
|
||||
'currency' => 'IDR',
|
||||
'avatar_url' => asset('images/default-doctor-avatar.png'),
|
||||
'hospital' => $organization,
|
||||
'speciality' => $speciality,
|
||||
'rating' => rand(350, 500) / 10,
|
||||
|
||||
'is_chat_available' => $this->is_chat_available,
|
||||
'is_video_available' => $this->is_video_available,
|
||||
'is_walkin_available' => $this->is_walkin_available,
|
||||
'is_instant_chat_available' => $this->is_instant_chat_available,
|
||||
];
|
||||
return parent::toArray($request);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@ class SpecialityResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'code' => $this->code,
|
||||
'name' => $this->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user