Bläddra i källkod

view()->share('pros') from base controller

Vijayakrishnan 5 år sedan
förälder
incheckning
e27ba97c69
2 ändrade filer med 4 tillägg och 4 borttagningar
  1. 2 0
      app/Http/Controllers/Controller.php
  2. 2 4
      app/Http/Controllers/PatientController.php

+ 2 - 0
app/Http/Controllers/Controller.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Models\Pro;
 use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
 use Illuminate\Foundation\Bus\DispatchesJobs;
 use Illuminate\Foundation\Validation\ValidatesRequests;
@@ -18,5 +19,6 @@ class Controller extends BaseController
         if($session && $session->pro) {
             view()->share('pro', $session->pro);
         }
+        view()->share('pros', Pro::all());
     }
 }

+ 2 - 4
app/Http/Controllers/PatientController.php

@@ -11,8 +11,7 @@ class PatientController extends Controller
     public function dashboard(Request $request, Client $patient )
     {
         $mcpPros = Pro::where('is_enrolled_as_mcp', true)->get();
-        $pros = Pro::all();
-        return view('app.patient.dashboard', compact('patient','pros'));
+        return view('app.patient.dashboard', compact('patient'));
     }
 
     public function carePlan(Request $request, Client $patient )
@@ -62,8 +61,7 @@ class PatientController extends Controller
 
     public function notes(Request $request, Client $patient )
     {
-        $pros = Pro::all();
-        return view('app.patient.notes', compact('patient','pros'));
+        return view('app.patient.notes', compact('patient'));
     }
 
     public function flowSheets(Request $request, Client $patient )