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