Build a response for Laravel to show

@param \Illuminate\Http\Request $request
@return \Illuminate\Http\Response
183171
public function toResponse($request)
    {
        $headers = array();
        if ($this->retryAfter) {
            $headers = array('Retry-After' => $this->retryAfter);
        }

        // Figure out what view to show them
        // @TODO: fallback to the default 503 page (laravel/framework/src/Illuminate/Foundation/Exceptions/views/503.blade.php)
        $view = view()->first([$this->view, config("maintenancemode.view"), "errors/503", "maintenancemode::app-down"], []);

        return response($view, 503)->withHeaders($headers);
    }
1003931
public function send(Request $request)
    {
        foreach ($this->cookies as $cookie) {
            $request->addCookie($cookie);
        }

        $response = $this->client->request($request);

        if ($response->getCookies()) {
            $this->cookies = $response->getCookies();
        }

        return $response;
    }
769004
public function indexAction(Request $request)
    {
        /** @var RedirectionRepository $errorRepository */
        $redirectionRepository = $this->getDoctrine()->getManager()->getRepository('VictoireSeoBundle:Redirection');

        // Fetch errors

        /** @var QueryBuilder $redirections */
        $redirections = $redirectionRepository->getUnresolvedQuery()->getQuery()->getResult();

        // Build forms

        $forms = [];

        /** @var Redirection[] $redirection */
        foreach ($redirections as $redirection) {
            $forms[$redirection->getId()] = $this->getRedirectionForm($redirection,
                sprintf('#redirection-%d-item-container', $redirection->getId())
            )->createView();
        }

        $newForm = $this->getRedirectionForm(new Redirection(), '#new-redirection-form-container')->createView();

        // Return datas

        return new Response($this->renderView('@VictoireSeo/Redirection/index.html.twig', [
            'newForm'      => $newForm,
            'redirections' => $redirections,
            'forms'        => $forms,
        ]));
    }
211225
public function run(Request $request) {
    // process the requested action
    ObjectFactory::getInstance('actionMapper')->processAction($request, $this->response);
    return $this->response;
  }
281913
public function run(Request $request) {
		$prefs = $this->getServiceContainer()->getPreferenceLoader()->getSystemPreferences();
		$translator = $this->getServiceContainer()->getTranslator();
		$reg = $this->getServiceContainer()->getExtensionRegistry();
		$settings = $reg->getExtensions(AccountModule::EXT_SETTINGS);
		$section = $this->getParam('section');
		$routes = [];

		// build settings routes
		foreach ($settings as $ext) {
			$routes[$translator->trans($ext['slug'])] = $ext;
		}
			
		if (!isset($routes[$section])) {
			$url = $prefs->getAccountUrl() . $translator->trans('slug.settings');
			throw new ResourceNotFoundException(sprintf('No route found for %s/%s', $url, $section));
		}
			
		$ext = $routes[$section];
		$kernel = $this->getServiceContainer()->getKernel();
		$module = $this->getServiceContainer()->getModuleManager()->load($ext['module']);
		$action = $module->loadAction($ext['action'], 'html');
		$response = $kernel->handle($action, $request);
		
		if ($response instanceof RedirectResponse) {
			return $response;
		}
		
		return $this->responder->run($request, new Blank([
			'settings' => $settings, 
			'section' => $response->getContent()
		]));
	}
968561
public function addAction(Request $request): Response
    {
        $form = $this->formFactory->addTranslation();
        $form->handleRequest($request);

        /** @var TranslationAddData $data */
        $data = $form->getData();
        $location = $data->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (TranslationAddData $data) {
                $location = $data->getLocation();
                $contentInfo = $location->getContentInfo();
                $language = $data->getLanguage();
                $baseLanguage = $data->getBaseLanguage();

                return new RedirectResponse($this->generateUrl('ezplatform.content.translate', [
                    'contentId' => $contentInfo->id,
                    'fromLanguageCode' => null !== $baseLanguage ? $baseLanguage->languageCode : null,
                    'toLanguageCode' => $language->languageCode,
                ]));
            });

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

        $redirectionUrl = null !== $location
            ? $this->generateUrl('_ezpublishLocation', ['locationId' => $location->id])
            : $this->generateUrl('ezplatform.dashboard');

        return $this->redirect($redirectionUrl);
    }
488416
public function search(Request $request)
    {
        $images = $this->imageRepository->search($request->term);

        if($request->ajax()) return response()->json([
            'images' => view('laramanager::browser.images', compact('images'))->render()
        ]);

        return view('laramanager::images.index', compact('images'));
    }
1005204
public function index(Request $request)
    {
        $this->validate($request, ['thread_id' => ['required']]);

        $posts = $this->model()->where('thread_id', $request->input('thread_id'))->get();

        return $this->response($posts);
    }
724425
public function run(Request $request) {
		$prefs = $this->getServiceContainer()->getPreferenceLoader()->getSystemPreferences();
		$routes = $this->generateRoutes();
		$response = new Response();
		$context = new RequestContext($prefs->getAccountUrl());
		$matcher = new UrlMatcher($routes, $context);
		$payload = [];

		$match = $matcher->match($this->getDestination());
		$route = $match['_route'];
		$module = $this->getModule();
		$auth = $this->getServiceContainer()->getAuthManager();
		$action = null;

		switch ($route) {
			case 'index':
				if ($auth->isRecognized()) {
					$action = $module->loadAction('dashboard', 'html');
				} else {
					$action = $module->loadAction('index', 'html');
				}
				break;

			case 'register':
				$action = $module->loadAction('register', 'html');
				break;

			case 'forgot-password':
			case 'forgot-password-token':
				$action = $module->loadAction('forgot-password', 'html');
				$action->setParams([
					'token' => isset($match['token']) ? $match['token'] : null
				]);
				break;

			case 'login':
				$action = $module->loadAction('login', 'html');
				break;

			case 'activity':
				$action = $module->loadAction('activity', 'html');
				break;

			case 'settings':
				$action = $module->loadAction('settings', 'html');
				$action->setParams([
					'section' => $match['section']
				]);
				break;

			case 'logout':
				$action = $module->loadAction('logout');
				break;
		}

		$kernel = $this->getServiceContainer()->getKernel();
		$response = $kernel->handle($action, $request);

		if ($response instanceof RedirectResponse) {
			return $response;
		}

		$payload = [
			'main' => $response->getContent(),
		];

		return $this->responder->run($request, new Blank($payload));
	}
464439
public function send(Request $request)
    {
        $response     = new PutSchemaResponse();
        $httpRequest  = $this->createHttpRequest($request);

        $this->client->send($httpRequest);

        return $response;
    }
211661
public function handle(Request $request) : Response
    {
        try {
            return $this->handleRequest($request);
        } catch (HttpException $e) {
            return $this->handleHttpException($e, $request);
        } catch (\Throwable $e) {
            return $this->handleUncaughtException($e, $request);
        }
    }
905262
public function send(Request $request)
    {
        $response   = new PutResponse();
        $rpbPutReq  = $this->createRpbMessage($request);
        $rpbPutResp = $this->client->send($rpbPutReq, RiakMessageCodes::PUT_REQ, RiakMessageCodes::PUT_RESP);

        if ( ! $rpbPutResp instanceof RpbPutResp) {
            return $response;
        }

        if ( ! $rpbPutResp->hasContent()) {
            return $response;
        }

        if ($rpbPutResp->hasKey()) {
            $response->key = $rpbPutResp->key;
        }

        $response->vClock      = $rpbPutResp->getVclock()->get();
        $response->contentList = $this->createContentList($rpbPutResp->getContentList());

        return $response;
    }
439934
protected function sendRequest(Request $request): Response
    {
        // Set password authentication for request.
        if ($this->password !== null) {
            $request->authenticate($this->password);
        }

        $this->send((string) $request);
        $response = new Response($this->get());
        return $response;

    }
266752
public function route(Request $request) : Response
    {
        $method = $request->getMethod();

        /** @var ParsedRoute $route */
        foreach ($this->routeCollection->get($method) as $route) {
            $compiledRoute = $this->compiler->compile($route, $request);

            if ($compiledRoute->isMatch()) {
                $this->matchedRoute = $compiledRoute;

                return $this->dispatcher->dispatch($this->matchedRoute, $request, $this->matchedController);
            }
        }

        // If we've gotten here, we've got a missing route
        throw new HttpException(404);
    }
1279098
public function sendRequest(Request $request)
    {
        $response = $this->httpClient->send($request);

        $this->checkErrorResponse($response);

        return $response;
    }
667783
public function send(Request $request)
    {
        $request->configure($this->config);

        $httpClient = new \GuzzleHttp\Client();

        $r = $httpClient->request('POST', $this->getUrl(), [
            'body' => \GuzzleHttp\Psr7\stream_for((string) $request),
        ]);

        return Response::create($r->getBody()->getContents());
    }
347723
public function allAction(Request $request)
    {
        $model = $this->getModel();

        $content = $this->restUtils->serialize($model->findAll($request));

        $response = $this->getResponse()
            ->setStatusCode(Response::HTTP_OK)
            ->setContent($content);

        return $response;
    }