/** * @param ServerRequestInterface $request * @param ResponseInterface $response * @return HtmlResponse */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response) { /** * @var Session $session */ $session = $request->getAttribute('session'); $flashMessage = $session->getSegment('App\\Album')->getFlash('flash'); $albums = $this->albumService->listAlbums(); return new HtmlResponse($this->template->render('album::index', compact('albums', 'flashMessage'))); }
/** * @param ServerRequestInterface $request * @param ResponseInterface $response * @return HtmlResponse */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response) { $albums = $this->albumService->listAlbums(); return new HtmlResponse($this->template->render('album::index', compact('albums'))); }