setStatusCode(302); $response->headers->set('Location', '/login?return_to='.$request->getPathInfo()); return false; } else { return true; } } public function index(Request $request, Response $response) { $response->setContent(view('index', [ 'title' => 'Telegraph' ])); return $response; } public function dashboard(Request $request, Response $response) { if(!$this->_is_logged_in($request, $response)) { return $response; } $response->setContent(view('dashboard', [ 'title' => 'Dashboard' ])); return $response; } }