| xqd
@@ -48,20 +48,24 @@ class OrderVaccinesController extends AdminController
|
|
|
});
|
|
|
// $grid->model()->orderByDesc('orders.id');
|
|
|
|
|
|
-// if(!empty($res['orderPatient']['appoint_start_time']['start']) || !empty($res['orderPatient']['appoint_start_time']['start']) ){
|
|
|
-//
|
|
|
+ if(!empty($res['orderPatient']['appoint_start_time']['start']) || !empty($res['orderPatient']['appoint_start_time']['start']) ){
|
|
|
+
|
|
|
// $grid->model()->leftJoin('order_patients','order_patients.order_id','=','orders.id')->orderByDesc('order_patients.appoint_start_time');
|
|
|
-//
|
|
|
+
|
|
|
// $grid->model()->whereHas('orderPatient',function($query){
|
|
|
// $query->orderBy( OrderPatient::select('appoint_start_time')
|
|
|
// ->whereColumn('order_id', 'orders.id')
|
|
|
// ->orderBy('appoint_start_time', 'asc'));
|
|
|
// });
|
|
|
-// } else {
|
|
|
-// $grid->model()->whereHas('orderPatient',function($query){
|
|
|
-// return $query->orderBy('appoint_start_time','desc')->groupBy('appoint_start_time');
|
|
|
-// });
|
|
|
-// }
|
|
|
+
|
|
|
+ $grid->model()->whereHas('orderPatient',function($query){
|
|
|
+ $query->orderBy( 'appoint_start_time','asc');
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $grid->model()->whereHas('orderPatient',function($query){
|
|
|
+ return $query->orderBy('appoint_start_time','desc')->groupBy('appoint_start_time');
|
|
|
+ });
|
|
|
+ }
|
|
|
DB::enableQueryLog();
|
|
|
|
|
|
// select bm_orders.*,bm_order_patients.appoint_end_time,bm_order_patients.appoint_start_time,bm_order_patients.name from `bm_orders`
|