Docs LATEST

Request & Response

Request input and response helpers.

HTTP & Routing

Request #

Access input from query or body:

$request->input('title');
$request->query('page');
$request->post('email');

JSON bodies are merged into the request automatically.

Useful helpers #

  • method()
  • path()
  • rawPath()
  • url()
  • host()
  • expectsJson()
  • isJson()
  • ajax()
  • validate($rules)

Tenancy path prefix #

When path-based tenancy is enabled, path() returns the route path with the tenant segment removed, while rawPath() returns the original request path.

Response #

return Response::html('<h1>Hello</h1>');
return Response::json(['ok' => true]);
return Response::redirect('/login');
return Response::file(storage_path('exports/report.pdf'));

You can also set headers and status:

return Response::json(['ok' => true])
	->status(201)
	->header('X-App', 'Velvet');