The response function creates a response instance or obtains an instance of the response factory:
<?php return response('Hello World', 200, $headers);

return response()->json(['foo' => 'bar'], 200, $headers);
<?php     public function toResponse($request)

    {

        return $request->expectsJson()

            ? response()->json(['message' => $this->getMessage()], 401)

            : redirect()->route('statamic.cp.login');

    }

}
<?php     protected function renderException($request, $e)

    {

        if ($e instanceof NotFoundHttpException) {

            return response()->json(['message' => $e->getMessage() ?: 'Not found.'], 404);

        }



        if ($e instanceof StatamicProAuthorizationException) {
<?php     public function render()

    {

        if (Statamic::isCpRoute()) {

            return response()->view('statamic::errors.404', [], 404);

        }



        if (view()->exists('errors.404')) {
<?php         }



        if (view()->exists('errors.404')) {

            return response($this->contents(), 404);

        }

    }
<?php         if ($redirect = $action->redirect($items, $values)) {

            return ['redirect' => $redirect];

        } elseif ($download = $action->download($items, $values)) {

            return $download instanceof Response ? $download : response()->download($download);

        }



        if (is_string($response)) {
<?php         $filesystem = $asset->disk()->filesystem()->getDriver();

        $stream = $filesystem->readStream($file);



        return response()->stream(function () use ($stream) {

            fpassthru($stream);

        }, 200, [

            'Content-Type' => $filesystem->getMimetype($file),
<?php         $asset->delete();



        return response('', 204);

    }

}
<?php     protected function authenticated(Request $request, $user)

    {

        return $request->expectsJson()

            ? response('Authenticated')

            : redirect()->intended($this->redirectPath());

    }
<?php         $entry->delete();



        return response('', 204);

    }



    protected function extractFromFields($entry, $blueprint)
<?php     public function pageNotFound()

    {

        return response()->view('statamic::errors.404', [], 404);

    }



    public function authorize($ability, $args = [], $message = null)
<?php             })->all(),

        ])->save();



        return response('', 204);

    }



    public function create()
<?php         $fieldset->delete();



        return response('');

    }

}
<?php         if ($this->request->has('download')) {

            $path = storage_path('statamic/tmp/forms/'.$form->handle().'-'.time().'.'.$type);

            File::put($path, $content);

            $response = response()->download($path)->deleteFileAfterSend(true);

        } else {

            $response = response($content)->header('Content-Type', $exporter->contentType());

        }
<?php             File::put($path, $content);

            $response = response()->download($path)->deleteFileAfterSend(true);

        } else {

            $response = response($content)->header('Content-Type', $exporter->contentType());

        }



        return $response;
<?php         $submission->delete();



        return response('', 204);

    }



    public function show($form, $submission)