Merge branch 'master' of http://itcorp.primaya.id:3000/rajif/aso
This commit is contained in:
@@ -43,10 +43,12 @@ class SearchController extends Controller
|
||||
->when($request->lat && $request->lng, function (EloquentBuilder $query) use ($request) {
|
||||
$query->getQuery()
|
||||
->selectRaw("organizations.id, organizations.name, addresses.text AS address, cities.name AS city_name, 6371 * acos (cos ( radians($request->lat) ) * cos( radians( addresses.lat ) ) * cos( radians( addresses.lng ) - radians($request->lng) ) + sin ( radians($request->lat) ) * sin( radians( addresses.lat ) )) as distance")
|
||||
->groupBy(['organizations.id', 'organizations.name', 'addresses.text', 'practitioner_roles.organization_id', 'practitioner_roles.speciality_id', 'addresses.lat', 'addresses.lng', 'cities.name'])
|
||||
->orderBy('distance', 'ASC');
|
||||
}, function (EloquentBuilder $query) {
|
||||
$query->getQuery()
|
||||
->select(['organizations.id', 'organizations.name', 'addresses.text AS address', 'cities.name AS city_name'])
|
||||
->groupBy(['organizations.id', 'organizations.name', 'addresses.text', 'practitioner_roles.organization_id', 'practitioner_roles.speciality_id', 'cities.name'])
|
||||
->orderBy('organizations.name');
|
||||
})
|
||||
->leftJoin('addresses', function (Builder $query) {
|
||||
@@ -64,7 +66,6 @@ class SearchController extends Controller
|
||||
->where('specialities.name', 'LIKE', "{$request->value}%")
|
||||
->where('addresses.addressable_type', '=', Organization::class)
|
||||
->whereNot('practitioner_roles.speciality_id')
|
||||
->groupBy(['practitioner_roles.organization_id', 'practitioner_roles.speciality_id'])
|
||||
->get();
|
||||
|
||||
return Helper::responseJson(data: ['hospitals' => HospitalResource::collection($queryHospitals)], message: 'Data rumah sakit berhasil di ambil');
|
||||
|
||||
@@ -39,6 +39,8 @@ class SpecialityController extends Controller
|
||||
->where('speciality_id', $specialityId)
|
||||
->get();
|
||||
|
||||
abort_if(count($doctors) === 0, Response::HTTP_NOT_FOUND, 'Data Doctor tidak ditemukan');
|
||||
|
||||
foreach ($doctors as $key => $doctor) {
|
||||
$specialisName = $doctor->speciality->name;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,6 @@ Route::prefix('linksehat')->group(function () {
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::get('profile', [ProfileController::class, 'index'])->name('profile');
|
||||
Route::post('profile', [ProfileController::class, 'update'])->name('profile.update');
|
||||
Route::apiResource('persons', PersonController::class)->except(['destroy']);
|
||||
Route::apiResource('families', PersonController::class)->except(['destroy']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,20 +16,20 @@ class OrganizationSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$response = Http::get('https://api.primaya.id/temp/organizations');
|
||||
$response = Http::get('https://app.primaya.id/temp/organizations');
|
||||
|
||||
foreach ($response->json()['organizations'] as $organization) {
|
||||
$newOrganization = Organization::updateOrCreate([
|
||||
'code' => 'ORG000'.$organization['code'],
|
||||
],[
|
||||
'code' => 'ORG000'.$organization['code'],
|
||||
'code' => 'ORG000' . $organization['code'],
|
||||
], [
|
||||
'code' => 'ORG000' . $organization['code'],
|
||||
'name' => $organization['name'],
|
||||
'type' => 'hospital',
|
||||
]);
|
||||
|
||||
$newAddress = $newOrganization->addresses()->updateOrCreate([
|
||||
'id' => $newOrganization->main_address_id
|
||||
],[
|
||||
], [
|
||||
'use' => 'both',
|
||||
'type' => 'physical',
|
||||
'text' => $organization['address'],
|
||||
@@ -49,14 +49,15 @@ class OrganizationSeeder extends Seeder
|
||||
]);
|
||||
$newOrganization->metas()->updateOrCreate([
|
||||
'type' => 'phone',
|
||||
],[
|
||||
], [
|
||||
'system' => 'default',
|
||||
'type' => 'phone',
|
||||
'value' => $organization['phone']
|
||||
]);
|
||||
$newOrganization->metas()->updateOrCreate([
|
||||
'type' => 'timezone',
|
||||
],['system' => 'default',
|
||||
], [
|
||||
'system' => 'default',
|
||||
'type' => 'timezone',
|
||||
'value' => $organization['timezone']
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user