/**
  * Use a ResponseObject to generate a browser redirect, based on config options
  *
  * @param              $key
  * @param BaseResponse $response
  *
  * @return Response
  */
 public function redirectViaResponse($key, BaseResponse $response)
 {
     if ($response->isSuccessful()) {
         $message = ['success' => $response->getMessage()];
     } else {
         $message = ['error' => $response->getMessage()];
     }
     // Was an error caught? If so we need to redirect back.
     if ($response->isError()) {
         return $this->redirectBack($message, $response->getPayload());
     }
     return $this->redirectTo($key, $message, $response->getPayload());
 }
Ejemplo n.º 2
0
 /**
  * Use a ResponseObject to generate a browser redirect, based on config options
  *
  * @param              $key
  * @param BaseResponse $response
  *
  * @return Response
  */
 public function redirectViaResponse($key, BaseResponse $response)
 {
     if ($response->isSuccessful()) {
         $message = ['success' => $response->getMessage()];
     } else {
         $message = ['error' => $response->getMessage()];
     }
     // Was an error caught? If so we need to redirect back.
     if ($response->isError()) {
         // exit('not errxxxxxxxxxxx');
         return Response::json(array_merge($message));
         return $this->redirectBack($message, $response->getPayload());
     }
     // exit('not err');
     return Response::json(array_merge($message));
     return $this->redirectTo($key, $message, $response->getPayload());
 }