|
@@ -262,14 +262,14 @@ class Pro extends Model
|
|
public function getMyClientIds(){
|
|
public function getMyClientIds(){
|
|
|
|
|
|
$accessibleClientIds = [];
|
|
$accessibleClientIds = [];
|
|
-
|
|
|
|
|
|
+
|
|
$clientProAccesses = ClientProAccess::where('pro_id', $this->id)->get();
|
|
$clientProAccesses = ClientProAccess::where('pro_id', $this->id)->get();
|
|
foreach($clientProAccesses as $cpa){
|
|
foreach($clientProAccesses as $cpa){
|
|
$accessibleClientIds[] = $cpa->client_id;
|
|
$accessibleClientIds[] = $cpa->client_id;
|
|
}
|
|
}
|
|
|
|
|
|
$appointmentClientIds = [];
|
|
$appointmentClientIds = [];
|
|
-
|
|
|
|
|
|
+
|
|
$appointments = Appointment::where('pro_id', $this->id)->get();
|
|
$appointments = Appointment::where('pro_id', $this->id)->get();
|
|
foreach($appointments as $appts){
|
|
foreach($appointments as $appts){
|
|
$appointmentClientIds[] = $appts->client_id;
|
|
$appointmentClientIds[] = $appts->client_id;
|
|
@@ -288,8 +288,17 @@ class Pro extends Model
|
|
foreach($clients as $client){
|
|
foreach($clients as $client){
|
|
$clientIds[] = $client->id;
|
|
$clientIds[] = $client->id;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return $clientIds;
|
|
return $clientIds;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function favoritesByCategory($_category) {
|
|
|
|
+ return ProFavorite::where('pro_id', $this->id)
|
|
|
|
+ ->where('is_removed', false)
|
|
|
|
+ ->where('category', $_category)
|
|
|
|
+ ->orderBy('category', 'asc')
|
|
|
|
+ ->orderBy('position_index', 'asc')
|
|
|
|
+ ->get();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|