|
@@ -260,36 +260,11 @@ class Pro extends Model
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public function getMyClientIds(){
|
|
|
|
-
|
|
|
|
- $accessibleClientIds = [];
|
|
|
|
-
|
|
|
|
- $clientProAccesses = ClientProAccess::where('pro_id', $this->id)->get();
|
|
|
|
- foreach($clientProAccesses as $cpa){
|
|
|
|
- $accessibleClientIds[] = $cpa->client_id;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $appointmentClientIds = [];
|
|
|
|
-
|
|
|
|
- $appointments = Appointment::where('pro_id', $this->id)->get();
|
|
|
|
- foreach($appointments as $appts){
|
|
|
|
- $appointmentClientIds[] = $appts->client_id;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $clients = Client::where('mcp_pro_id', $this->id)
|
|
|
|
- ->orWhere('cm_pro_id', $this->id)
|
|
|
|
- ->orWhere('rmm_pro_id', $this->id)
|
|
|
|
- ->orWhere('rme_pro_id', $this->id)
|
|
|
|
- ->orWhere('rd_pro_id', $this->id)
|
|
|
|
- ->orWhereIn('id', $accessibleClientIds)
|
|
|
|
- ->orWhereIn('id', $appointmentClientIds)->get();
|
|
|
|
-
|
|
|
|
- $clientIds = [];
|
|
|
|
-
|
|
|
|
|
|
+ public function getMyClientIds() {
|
|
|
|
+ $clients = $this->getAccessibleClientsQuery()->get();
|
|
foreach($clients as $client){
|
|
foreach($clients as $client){
|
|
$clientIds[] = $client->id;
|
|
$clientIds[] = $client->id;
|
|
}
|
|
}
|
|
-
|
|
|
|
return $clientIds;
|
|
return $clientIds;
|
|
}
|
|
}
|
|
|
|
|