|
@@ -260,8 +260,8 @@ class Pro extends Model
|
|
|
|
|
|
}
|
|
|
|
|
|
- public function getMyClientIds() {
|
|
|
- $clients = $this->getAccessibleClientsQuery()->get();
|
|
|
+ public function getMyClientIds($_search = false) {
|
|
|
+ $clients = $this->getAccessibleClientsQuery($_search)->get();
|
|
|
$clientIds = [];
|
|
|
foreach($clients as $client){
|
|
|
$clientIds[] = $client->id;
|
|
@@ -278,10 +278,10 @@ class Pro extends Model
|
|
|
->get();
|
|
|
}
|
|
|
|
|
|
- public function getAccessibleClientsQuery() {
|
|
|
+ public function getAccessibleClientsQuery($_search = false) {
|
|
|
$proID = $this->id;
|
|
|
$query = Client::whereNull('shadow_pro_id');
|
|
|
- if ($this->pro_type === 'ADMIN') {
|
|
|
+ if ($this->pro_type === 'ADMIN' && ($_search ? $this->can_see_any_client_via_search : $this->can_see_all_clients_in_list)) {
|
|
|
$query = $query->where('id', '>', 0);
|
|
|
} else {
|
|
|
$query = $query->where(function ($q) use ($proID) {
|