public function index() { $countDiagnostic = count(auth()->user()->diagnostics); $countDiseases = Disease::count(); $countSymptom = Symptom::count(); $diagnostics = Diagnostic::with('disease')->where('user_id', auth()->user()->id)->orderBy('created_at', 'desc')->take(5)->get(); return view('user.home')->with('countSymptom', $countSymptom)->with('countDiseases', $countDiseases)->with('countDiagnostic', $countDiagnostic)->with('diagnostics', $diagnostics); }
public function home() { $countDiseases = Disease::count(); $countSymptom = Symptom::count(); $countDiagnostic = Diagnostic::count(); $lastRegistered = User::orderBy('created_at', 'desc')->take(9)->get(); return view('admin.home')->with('countDiagnostic', $countDiagnostic)->with('countSymptom', $countSymptom)->with('countDiseases', $countDiseases)->with('lastRegistered', $lastRegistered); }