Update Doctors
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Models\PractitionerRole;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Modules\Linksehat\Transformers\DoctorResource;
|
||||
use Modules\Linksehat\Transformers\PractitionerRoleToDoctorDetailResource;
|
||||
use Modules\Linksehat\Transformers\PractitionerRoleToDoctorResource;
|
||||
|
||||
@@ -33,9 +34,13 @@ class DoctorController extends Controller
|
||||
} else if ($request->has('hospital_id')) {
|
||||
$doctors->where('organization_id', $request->hospital_id);
|
||||
}
|
||||
|
||||
$doctors = $doctors->paginate(6);
|
||||
|
||||
|
||||
$limit = $request->limit ?? 6;
|
||||
if ($limit > 20) {
|
||||
$limit = 20;
|
||||
}
|
||||
|
||||
$doctors = $doctors->paginate($limit);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Sukses mengambil data Dokter',
|
||||
@@ -69,12 +74,18 @@ class DoctorController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$doctor = PractitionerRole::query()
|
||||
->with(['practitioner', 'practitioner.person', 'speciality', 'practitioner.metas', 'metas', 'organization'])
|
||||
->where('id', $id)
|
||||
->firstOrFail();
|
||||
|
||||
return response()->json(PractitionerRoleToDoctorDetailResource::make($doctor));
|
||||
$doctor = Practitioner::query()
|
||||
->with([
|
||||
'practitionerRoles',
|
||||
'practitionerRoles.metas',
|
||||
'practitionerRoles.speciality',
|
||||
'practitionerRoles.organization',
|
||||
'person',
|
||||
'metas',
|
||||
])
|
||||
->findOrFail($id);
|
||||
|
||||
return response()->json(DoctorResource::make($doctor));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user