Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 /**
  * @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;
 }
Пример #3
0
 /**
  * @param ServerRequestInterface $request
  * @return ResponseInterface
  */
 public function logout(ServerRequestInterface $request)
 {
     Session::set('isLogin', false);
     Session::set('username', null);
     return Response::back($request);
 }
Пример #4
0
 /**
  * @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');
 }
Пример #5
0
 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')));
 }