authorizeAbility($request, 'nursing.performance.view'); $this->authorizeOwner($request, $careUnit); abort_unless((int) $careUnit->organization_id === (int) $this->organization($request)->id, 404); $from = $request->filled('from') ? Carbon::parse($request->input('from'))->startOfDay() : now()->subDays(7)->startOfDay(); $to = $request->filled('to') ? Carbon::parse($request->input('to'))->endOfDay() : now()->endOfDay(); $report = $performance->unitReport($careUnit, $this->ownerRef($request), $from, $to); return view('care.nursing.performance', [ 'unit' => $careUnit->load('department.branch'), 'report' => $report, 'canManage' => app(CarePermissions::class)->can($this->member($request), 'admin.departments.manage'), ]); } }