Example #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);
 }
Example #2
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');
 }
Example #3
0
 /**
  * @param ServerRequestInterface $request
  * @return ResponseInterface
  */
 public function destroy(ServerRequestInterface $request)
 {
     $username = $request->getAttribute('username');
     if ($this->repository->count() <= 1) {
         return Response::factory(400, "this is the last member!");
     }
     $this->repository->where(compact('username'))->delete();
     return Response::redirect('/admin/users');
 }