/** * All Redirect to Hashbang * * @todo history.pushState * * @param ServerRequestInterface $request * @return ResponseInterface */ public function redirect(ServerRequestInterface $request) { $redirectUrl = '/admin/#!/' . $request->getAttribute('path'); if ($query = $request->getUri()->getQuery()) { $redirectUrl .= '?' . $query; } return Response::redirect($redirectUrl); }
/** * @param ServerRequestInterface $request * @return ResponseInterface */ public function execute(ServerRequestInterface $request) { $this['request'] = $request; $this->registerServiceProviders(); $this->registerControllers($this['router.controllers']); $this->registerFacade(); $this->registerRoutes($router = $this['router']); try { $response = $router->dispatch($request); } catch (HandlerNotFoundException $e) { $response = Response::error404(); } return $response; }
/** * @param ServerRequestInterface $request * @return ResponseInterface */ public function logout(ServerRequestInterface $request) { Session::set('isLogin', false); Session::set('username', null); return Response::back($request); }
/** * @param ServerRequestInterface $request * @return ResponseInterface */ public function destroy(ServerRequestInterface $request) { $id = $request->getAttribute('id'); $this->repository->where(compact('id'))->delete(); return Response::redirect('/admin/settings/categories'); }
public function store_popup(ServerRequestInterface $request) { $id = $request->getAttribute('id'); $post = $this->repository->where(['id' => $id])->one(); return Response::plain($this->view->render('store_popup', compact('post'))); }