|
@@ -1063,13 +1063,13 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
|
|
|
|
|
|
$results = DB::table('appointment')->select('raw_date')->distinct()->where("start_time", '>=', $from)->where("start_time", '<=', $to.' 23:59:00+00');
|
|
|
|
|
|
+ $results = $results->leftJoin('client AS c', 'c.id', '=', 'appointment.id');
|
|
|
+
|
|
|
if(!$isAdmin) {
|
|
|
- $appointments = $appointments->where(function($q) use ($performerProID) {
|
|
|
- return $q->where("pro_id", $performerProID)
|
|
|
- ->orWhereHas('client', function($clientQuery) use ($performerProID){
|
|
|
- return $clientQuery->where('default_na_pro_id', $performerProID);
|
|
|
- });
|
|
|
- });
|
|
|
+ $results = $results->where(function($query) use ($performerProID){
|
|
|
+ return $query->where('appointment.pro_id', $performerProID)
|
|
|
+ ->orWhere('c.default_na_pro_id', $performerProID);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
$results = $results->get();
|