/**
  * Store a newly created Cuenta in storage.
  *
  * @param CreateCuentaRequest $request
  *
  * @return Response
  */
 public function store(CreateCuentaRequest $request)
 {
     $input = $request->all();
     $cuenta = $this->cuentaRepository->create($input);
     Flash::success('Cuenta agregada satisfactoriamente.');
     return redirect(route('cuentas.index'));
 }
 /**
  * Store a newly created Cuenta in storage.
  *
  * @param CreateCuentaRequest $request
  *
  * @return Response
  */
 public function store(CreateCuentaRequest $request)
 {
     $input = $request->all();
     try {
         $cuenta = $this->cuentaRepository->create($input);
         Flash::success('Cuenta agregada satisfactoriamente.');
         return redirect(route('cuentas.index'));
     } catch (QueryException $e) {
         if (preg_match('/Duplicate entry/', $e->getMessage())) {
             return response(['success' => false, 'message' => 'Role exists for that user'], 500);
         }
     }
 }