public function isDoctorVisited($doctorId, $date) { $visited = AMReport::where('am_id', \Auth::user()->id)->where('doctor_id', $doctorId)->where('date', '>=', $date)->count(); if ($visited > 0) { return true; } }
public function listAll() { $employees = Employee::select('id')->where('manager_id', \Auth::user()->id)->get(); $MRReports = Report::whereIn('mr_id', $employees)->get(); $yourReports = AMReport::where('am_id', \Auth::user()->id)->get(); $dataView = ['MRReports' => $MRReports, 'yourReports' => $yourReports]; return view('am.report.list', $dataView); }
public function index() { $employees = Employee::select('line_id')->where('manager_id', \Auth::user()->id)->get(); $products = Product::whereIn('line_id', $employees)->get(); $employees = Employee::select('id')->where('manager_id', \Auth::user()->id)->get(); $customers = Customer::whereIn('mr_id', $employees)->get(); $employees = Employee::where('manager_id', \Auth::user()->id)->get(); $dataView = ['productsCount' => count($products), 'plansCount' => AMPlan::where('month', \Config::get('app.current_month'))->count(), 'reportsCount' => AMReport::where('month', \Config::get('app.current_month'))->count(), 'customersCount' => count($customers), 'employeesCount' => count($employees)]; return view('am.index', $dataView); }