فهرست منبع

timePeriodList

Mike 4 سال پیش
والد
کامیت
26c0aca48c
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      app/Http/Controllers/Api/V1/DocterController.php

+ 3 - 3
app/Http/Controllers/Api/V1/DocterController.php

xqd xqd
@@ -186,7 +186,7 @@ class DocterController extends AuthController
             'latitude' => 'numeric',
             'longitude' => 'numeric',
         ]);
-        $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_type',1)->where('schedule_day', '>=', date('Ymd'));
+        $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_type',1)->where('schedule_day', '>=', date('Ymd'))->orderBy('schedule_day');
         if (!empty($req['organization_id'])) {
             $builder->where('organization_id', $req['organization_id']);
         }
@@ -278,12 +278,12 @@ class DocterController extends AuthController
             'latitude' => 'numeric',
             'longitude' => 'numeric',
         ]);
-        $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('organization_id', $req['organization_id'])->where('schedule_type', $req['schedule_type'])->where('schedule_day', '>=', date('Ymd'));
+        $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('organization_id', $req['organization_id'])->where('schedule_type', $req['schedule_type'])->where('schedule_day', '>=', date('Ymd'))->orderBy('schedule_day');
         $data = $builder->paginate($req['per_page']??15)->toArray();
+        $docterSettings = DocterSetting::select(['service_num'])->where('organization_id', $req['organization_id'])->where('type',$req['schedule_type'])->first();
         if (!empty($data)) {
             foreach ($data['data'] as $k => &$v) {
                 foreach ($v['schedule_period'] as $k1 => &$v1) {
-                    $docterSettings = DocterSetting::select(['service_num'])->where('docter_id', $req['docter_id'])->where('type', 1)->where('org_id', $v1['organization_id'])->first();
                     if (empty($docterSettings)) {
                         $v1['can_appoint_num'] = 0;
                     }