|
@@ -2,13 +2,11 @@
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
-use App\Models\AppSession;
|
|
|
use App\Models\Client;
|
|
|
use App\Models\Bill;
|
|
|
use App\Models\Note;
|
|
|
use App\Models\ProTransaction;
|
|
|
use Illuminate\Http\Request;
|
|
|
-use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
{
|
|
@@ -71,7 +69,17 @@ class HomeController extends Controller
|
|
|
|
|
|
public function patients(Request $request)
|
|
|
{
|
|
|
- $patients = Client::orderBy('name_last', 'asc')->orderBy('name_first', 'asc')->get();
|
|
|
+ $proID = $this->performer()->pro->id;
|
|
|
+ $patients = 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 pro_id = ?)', [$proID]);
|
|
|
+ })
|
|
|
+ ->orderBy('name_last', 'asc')
|
|
|
+ ->orderBy('name_first', 'asc')
|
|
|
+ ->get();
|
|
|
return view('app/patients', ['patients' => $patients]);
|
|
|
}
|
|
|
|