Redirects after order content changed.

@param Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse
180838
protected function redirectAfterContentChange(Request $request)
    {
        if (null !== $referer = $request->headers->get('referer', null)) {
            return $this->redirect($referer);
        }

        return $this->redirect($this->generateUrl('ekyna_cart_index'));
    }
1007509
public function postEmail(Request $request)
	{
		$this->validate($request, ['email' => 'required|email']);

		$response = $this->passwords->sendResetLink($request->only('email'), function($m)
		{
			$m->subject($this->getEmailSubject());
		});

		switch ($response)
		{
			case PasswordBroker::RESET_LINK_SENT:
				return redirect()->back()->with('status', trans($response));

			case PasswordBroker::INVALID_USER:
				return redirect()->back()->withErrors(['email' => trans($response)]);
		}
	}
666669
public function postAction(Request $request)
    {
        $data = $request->request->all();

        $serializer = $this->get('serializer');
        $redirectRoute = $serializer->deserialize(
            json_encode($data),
            $this->getParameter('sulu.model.redirect_route.class'),
            'json'
        );

        $this->getRedirectRouteManager()->save($redirectRoute);
        $this->get('doctrine.orm.entity_manager')->flush();

        return $this->handleView($this->view($redirectRoute));
    }
167230
public function moveDown(Request $request)
    {
        // AUTHORIZE ... COMES HERE
        $pageblock = $this->pageBlockRepository->moveDownById($request->get('pageblock_id'));
        return $pageblock;
    }
564064
public function postDispatched(Request $request)
    {
        $purchase = Purchase::findOrFail($request->input('purchase_id'));

        if ($purchase->item->seller->userId != Auth::user()->userId) {
            return redirect('/inventory/sold')->withErrors(["You are not seller of this item."]);
        }

        if ($purchase->isDispatched()) {
            return redirect('/inventory/sold')->withErrors(["This item has already been marked as dispatched."]);
        }

        if (!$purchase->deliveryOption) {
            return redirect('/inventory/sold')->withErrors(["This item is due to be collected."]);
        }

        $purchase->dispatched = time();
        $purchase->trackingNumber = $request->input('tracking_number');

        $purchase->save();

        $purchase->buyer->sendEmail(
            'Your item has been dispatched',
            'emails.item.dispatched',
            [
                'item_name' => $purchase->item->name,
                'delivery_service' => $purchase->deliveryOption->name,
                'tracking_number' => $purchase->trackingNumber,
                'arrival_time' => $purchase->deliveryOption->humanArrivalTime,
            ]
        );

        return redirect('/inventory/sold')->withStatus("This item has been marked as dispatched and the buyer notified.");
    }
410229
public function updateOrder(Request $request): JsonResponse
    {
        Category::rebuildTree(
            $request->input('tree')
        );

        $this->clearCache();

        $movedNode = Category::findOrFail(
            $request->input('moved')
        );

        dispatch(
            new RegenerateCategoryFullSlugs($movedNode)
        );

        return response()->json([
            'state' => 'success',
        ]);
    }
1098013
public function postLogin(Request $request)
    {

        $this->validate($request, ['username' => 'required|min:3|max:255', 'password' => 'required',]);

        $credentials = $request->only('username', 'password');
        $credentials[ 'enabled' ] = 1;

        if (Auth::attempt($credentials, $request->has('remember'))) {
            return redirect()->intended($this->getRedirectUrl());
        } else {
            return redirect(route('login'))->withInput($request->except(['password']))
                                           ->withErrors([$this->getFailedLoginMessage()]);
        }

    }
848028
public function sortItemConditions(Request $request)
    {
        $this->validate(
            $request,
            [
                'item_conditions' => 'required|array',
            ]
        );

        foreach ($request->input('item_conditions') as $item_condition_id => $sort) {
            $item_condition = ItemCondition::find($item_condition_id);

            $item_condition->sort = $sort;

            $item_condition->save();
        }

        return redirect()->back()->withStatus(trans('mustard::admin.item_conditions_sorted'));
    }
559881
public function createAction(Request $request)
    {
        $newTag = new Tag();
        $newTagForm = $this->createForm(new TagType(),$newTag);

        $newTagForm->handleRequest($request);

        if($newTagForm->isValid())
        {
            $em = $this->getDoctrine()->getManager();
            $em->persist($newTag);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('tag'));
    }
144952
public function updateAction(Request $request): Response
    {
        $form = $this->formFactory->updateLocation();
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationUpdateData $data) {
                $location = $data->getLocation();

                $locationUpdateStruct = new LocationUpdateStruct(['sortField' => $data->getSortField(), 'sortOrder' => $data->getSortOrder()]);
                $this->locationService->updateLocation($location, $locationUpdateStruct);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Location '%name%' updated.") */
                        'location.update.success',
                        ['%name%' => $location->getContentInfo()->name],
                        'location'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                        'locationId' => $location->getContentInfo()->mainLocationId,
                        '_fragment' => DetailsTab::URI_FRAGMENT,
                    ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $location->getContentInfo()->mainLocationId,
            '_fragment' => DetailsTab::URI_FRAGMENT,
        ]));
    }
491100
public function doAction(Request $request)
    {
        $token = $this->payum->getHttpRequestVerifier()->verify($request);

        $gateway = $this->payum->getGateway($token->getGatewayName());
        $gateway->execute(new Refund($token));

        $this->payum->getHttpRequestVerifier()->invalidate($token);

        return new RedirectResponse($token->getAfterUrl());
    }
1117029
public function upAction(Request $request)
    {
        /** @var MenuRepository $repo */
        $repo = $this->get('vince_cms.repository.menu');
        /** @var Menu $menu */
        $menu = $repo->find($request->get('id'));
        if ($menu->getParent()) {
            $repo->moveUp($menu);
        }

        return $this->redirect($this->generateUrl('admin_my_cms_menu_list'));
    }
79180
public function update(Request $request)
    {
        $action = $request->input('action');

        $thread = $this->api("thread.{$action}", $request->route('thread'))->parameters($request->all())->patch();

        Forum::alert('success', 'threads.updated', 1);

        return redirect(Forum::route('thread.show', $thread));
    }
112433
public function moveUpAction(Request $request)
    {
        $context = $this->loadContext($request);

        $resource = $context->getResource();

        $this->isGranted('EDIT', $resource);

        $this->move($resource, -1);

        return $this->redirectToReferer($this->generateUrl(
            $this->config->getRoute('list'),
            $context->getIdentifiers()
        ));
    }
836068
public function moveUpAction(Request $request)
    {
        $context = $this->loadContext($request);

        $resource = $context->getResource();

        $this->isGranted('EDIT', $resource);

        $repo = $this->getRepository();
        $repo->moveUp($resource, 1);

        return $this->redirectToReferer($this->generateUrl(
            $this->config->getRoute('list'),
            $context->getIdentifiers()
        ));
    }
993151
public function failureAction(Request $request)
    {
        $orderId = $request
            ->query
            ->get('id', false);

        $failureRoute = $this
            ->redirectionRoutes
            ->getRedirectionRoute('failure');

        $redirectUrl = $this
            ->urlGenerator
            ->generate(
                $failureRoute->getRoute(),
                $failureRoute->getRouteAttributes(
                    $orderId
                )
            );

        return new RedirectResponse($redirectUrl);
    }
457548
public function resetAction(Request $request)
    {
        $cart = $this->getCart();
        $event = new OrderEvent($cart);
        $this->get('ekyna_order.order.operator')->delete($event, true);
        if (!$event->hasErrors()) {
            $this->addFlash('ekyna_cart.message.reset');
        } else {
            $event->toFlashes($this->getFlashBag());
        }

        return $this->redirectAfterContentChange($request);
    }