add hospital detail

This commit is contained in:
Muhammad Fajar
2022-10-31 07:18:24 +07:00
parent 9b67ba420f
commit fd6b60038b
5 changed files with 197 additions and 8 deletions

View File

@@ -2,9 +2,7 @@
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;
@@ -25,14 +23,24 @@ class SpecialityController extends Controller
$messageorganizationId = !empty($organizationId) ? ' ' : ' organization_id or ';
$messageSpecialityId = !empty($specialityId) ? ' ' : 'speciality_id';
abort(400, 'missing parameter' . $messageorganizationId . $messageSpecialityId);
abort(400, 'Missing Parameter' . $messageorganizationId . $messageSpecialityId);
}
$doctors = PractitionerRole::query()->with(['practitioner.person', 'speciality'])->where('organization_id', $organizationId)->where('speciality_id', $specialityId)->get();
$doctors = PractitionerRole::query()
->with(['practitioner.person', 'speciality', 'prices'])
->whereHas('prices', function ($query) {
$query->where('priceable_type', 'App\Models\Practice');
})
->where('organization_id', $organizationId)
->where('speciality_id', $specialityId)
->get();
foreach ($doctors as $key => $doctor) {
$specialisName = $doctor->speciality->name;
}
// return $doctors;
return SpecialityResource::collection($doctors);
return 'c';
// Price belum ke ambil
return response()->json([
@@ -46,6 +54,32 @@ class SpecialityController extends Controller
]);
}
public function searchSpecialityOrPerson(Request $request)
{
$doctors = PractitionerRole::query()
->with(['practitioner.person', 'speciality'])
->whereHas('practitioner.person', function ($query) use ($request) {
$query->where('name', 'LIKE', "%{$request->value}%");
})
// ->whereHas('speciality', function ($query) use ($request) {
// $query->where('name', 'LIKE', "%{$request->value}%");
// })
->get();
return $doctors;
// Price belum ke ambil
// return response()->json([
// 'status' => true,
// 'statusCode' => 200,
// 'message' => 'Data Berhasil di ambil',
// 'data' => [
// 'title' => 'Spesialis ' . $specialisName,
// 'doctors' => SpecialityResource::collection($doctors)
// ]
// ]);
}
/**
* Show the form for creating a new resource.
* @return Renderable