api get person/doctor by speciality
This commit is contained in:
@@ -105,10 +105,9 @@ class DoctorController extends Controller
|
||||
$query->select(['availability_id', 'day']);
|
||||
}])->where('practitioner_role_id', $id)->get(['id', 'start_time']);
|
||||
|
||||
return $queryDoctor->is_chat_available;
|
||||
$doctor = DoctorResourceDetail::make($queryDoctor);
|
||||
$doctor['day_available'] = Helper::dailyAvailabilities($queryAvailables);
|
||||
// return $doctor;
|
||||
|
||||
return response()->json(compact('doctor'));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace Modules\Linksehat\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Practice;
|
||||
use App\Models\PractitionerRole;
|
||||
use App\Models\Price;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Modules\Linksehat\Transformers\Speciality\SpecialityResource;
|
||||
|
||||
class SpecialityController extends Controller
|
||||
{
|
||||
@@ -25,7 +28,22 @@ class SpecialityController extends Controller
|
||||
abort(400, 'missing parameter' . $messageorganizationId . $messageSpecialityId);
|
||||
}
|
||||
|
||||
return PractitionerRole::query()->with('practitioner')->where('organization_id', $organizationId)->where('speciality_id', $specialityId)->get();
|
||||
$doctors = PractitionerRole::query()->with(['practitioner.person', 'speciality'])->where('organization_id', $organizationId)->where('speciality_id', $specialityId)->get();
|
||||
|
||||
foreach ($doctors as $key => $doctor) {
|
||||
$specialisName = $doctor->speciality->name;
|
||||
}
|
||||
|
||||
// Price belum ke ambil
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'statusCode' => 200,
|
||||
'message' => 'Data Berhasil di ambil',
|
||||
'data' => [
|
||||
'title' => 'Spesialis ' . $specialisName,
|
||||
'doctors' => SpecialityResource::collection($doctors)
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user