|
@@ -244,13 +244,18 @@ class HomeController extends Controller
|
|
|
public function patients(Request $request, $filter = '')
|
|
|
{
|
|
|
$proID = $this->performer()->pro->id;
|
|
|
- $query = Client::where(function ($q) use($proID) {
|
|
|
- $q->where('mcp_pro_id', $proID)
|
|
|
- ->orWhere('cm_pro_id', $proID)
|
|
|
- ->orWhere('rmm_pro_id', $proID)
|
|
|
- ->orWhere('rme_pro_id', $proID)
|
|
|
- ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID]);
|
|
|
- });
|
|
|
+ if($this->performer()->pro->pro_type === 'ADMIN') {
|
|
|
+ $query = Client::where('id', '>', 0);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $query = Client::where(function ($q) use($proID) {
|
|
|
+ $q->where('mcp_pro_id', $proID)
|
|
|
+ ->orWhere('cm_pro_id', $proID)
|
|
|
+ ->orWhere('rmm_pro_id', $proID)
|
|
|
+ ->orWhere('rme_pro_id', $proID)
|
|
|
+ ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID]);
|
|
|
+ });
|
|
|
+ }
|
|
|
switch ($filter) {
|
|
|
case 'not-yet-seen':
|
|
|
$query = $query->where('has_mcp_done_onboarding_visit', '<>', 'YES');
|