user_id = $user->id; $this->user_name = $user->name; } else { $this->user_id = 0; $this->user_name = "Guest"; } } public function compose(View $view) { $view->with([ 'leftmenu' => (new FunMenu)->leftmenu($this->user_id), 'username' => $this->user_name ]); } }