public function prepareResponse($response)
    {
        $request = \app(Request::class);

        if ($response instanceof Responsable) {
            $response = $response->toResponse($request);
        }

        if ($response instanceof PsrResponseInterface) {
            $response = (new HttpFoundationFactory())->createResponse($response);
        } elseif (! $response instanceof SymfonyResponse) {
            $response = new Response($response);
        } elseif ($response instanceof BinaryFileResponse) {
            $response = $response->prepare(Request::capture());
        }

        return $response->prepare($request);
    }
public function prepareResponse($response)
    {
        $request = \app(Request::class);

        if ($response instanceof Responsable) {
            $response = $response->toResponse($request);
        }

        if ($response instanceof PsrResponseInterface) {
            $response = (new HttpFoundationFactory())->createResponse($response);
        } elseif (! $response instanceof SymfonyResponse) {
            $response = new Response($response);
        } elseif ($response instanceof BinaryFileResponse) {
            $response = $response->prepare(Request::capture());
        }

        return $response->prepare($request);
    }
public function prepareResponse ( $ response ) { $ request = \ app ( Request :: class ) ; if ( $ response instanceof Responsable ) { $ response = $ response -> toResponse ( $ request ) ; } if ( $ response instanceof PsrResponseInterface ) { $ response = ( new HttpFoundationFactory ( ) ) -> createResponse ( $ response ) ; } elseif ( ! $ response instanceof SymfonyResponse ) { $ response = new Response ( $ response ) ; } elseif ( $ response instanceof BinaryFileResponse ) { $ response = $ response -> prepare ( Request :: capture ( ) ) ; } return $ response -> prepare ( $ request ) ; }
Prepare the response for sending.

@param  mixed  $response

@return Response
Prepare the response for sending .