$this->getUsersPerMonth(), ]); } /** * {@inheritDoc} */ public function scripts(): View { return view('plugins.dashboard.widgets.registration-history-scripts', [ 'usersPerMonth' => $this->getUsersPerMonth(), ]); } private function getUsersPerMonth(): array { if (isset($this->usersPerMonth)) { return $this->usersPerMonth; } return $this->usersPerMonth = $this->users->countOfNewUsersPerMonthPerRole( Carbon::now()->subYear()->startOfMonth(), Carbon::now()->endOfMonth() ); } }