File
redirect.php
Package
Default
Class hierarchy
LaravelRedirect

Tags

None found

Properties

$content

$content : mixed

The content of the response.

Type

mixed

Inherited from
LaravelResponse

Tags

None found

$foundation

$foundation : \Laravel\HttpFoundation\Response

The Symfony HttpFoundation Response instance.

Type

LaravelHttpFoundationResponse

Inherited from
LaravelResponse

Tags

None found

Methods

__construct()

__construct(mixed  $content, integer  $status = 200, array  $headers = array()) : void

Create a new response instance.

Parameters

mixed $content
integer $status
array $headers

Inherited from
LaravelResponse

Tags

None found

make()

make(mixed  $content, integer  $status = 200, array  $headers = array()) : \Laravel\Response

Create a new response instance.

// Create a response instance with string content return Response::make(json_encode($user));

// Create a response instance with a given status
return Response::make('Not Found', 404);

// Create a response with some custom headers
return Response::make(json_encode($user), 200, array('header' => 'value'));

Parameters

mixed $content
integer $status
array $headers

Returns

LaravelResponse

static
Inherited from
LaravelResponse

Tags

None found

view()

view(string  $view, array  $data = array()) : \Laravel\Response

Create a new response instance containing a view.

// Create a response instance with a view return Response::view('home.index');

// Create a response instance with a view and data
return Response::view('home.index', array('name' => 'Taylor'));

Parameters

string $view
array $data

Returns

LaravelResponse

static
Inherited from
LaravelResponse

Tags

None found

json()

json(mixed  $data, integer  $status = 200, array  $headers = array(), integer  $json_options) : \Laravel\Response

Create a new JSON response.

// Create a response instance with JSON return Response::json($data, 200, array('header' => 'value'));

Parameters

mixed $data
integer $status
array $headers
integer $json_options

Returns

LaravelResponse

static
Inherited from
LaravelResponse

Tags

None found

jsonp()

jsonp(  $callback, mixed  $data, integer  $status = 200, array  $headers = array()) : \Laravel\Response

Create a new JSONP response.

// Create a response instance with JSONP return Response::jsonp('myFunctionCall', $data, 200, array('header' => 'value'));

Parameters

$callback
mixed $data
integer $status
array $headers

Returns

LaravelResponse

static
Inherited from
LaravelResponse

Tags

None found

eloquent()

eloquent(\Laravel\Eloquent|array  $data, integer  $status = 200, array  $headers = array()) : \Laravel\Response

Create a new response of JSON'd Eloquent models.

// Create a new response instance with Eloquent models return Response::eloquent($data, 200, array('header' => 'value'));

Parameters

LaravelEloquent|array $data
integer $status
array $headers

Returns

LaravelResponse

static
Inherited from
LaravelResponse

Tags

None found

error()

error(integer  $code, array  $data = array()) : \Laravel\Response

Create a new error response instance.

The response status code will be set using the specified code.

The specified error should match a view in your views/error directory.

// Create a 404 response return Response::error('404');

// Create a 404 response with data
return Response::error('404', array('message' => 'Not Found'));

Parameters

integer $code
array $data

Returns

LaravelResponse

static
Inherited from
LaravelResponse

Tags

None found

download()

download(string  $path, string  $name = null, array  $headers = array()) : \Laravel\Response

Create a new download response instance.

// Create a download response to a given file return Response::download('path/to/file.jpg');

// Create a download response with a given file name
return Response::download('path/to/file.jpg', 'your_file.jpg');

Parameters

string $path
string $name
array $headers

Returns

LaravelResponse

static
Inherited from
LaravelResponse

Tags

None found

disposition()

disposition(string  $file) : string

Create the proper Content-Disposition header.

Parameters

string $file

Returns

string

Inherited from
LaravelResponse

Tags

None found

prepare()

prepare(mixed  $response) : \Laravel\Response

Prepare a response from the given value.

Parameters

mixed $response

Returns

LaravelResponse

static
Inherited from
LaravelResponse

Tags

None found

send()

send() : void

Send the headers and content of the response to the browser.

Tags

None found

render()

render() : string

Convert the content of the Response to a string and return it.

Returns

string

Inherited from
LaravelResponse

Tags

None found

send_headers()

send_headers() : void

Send all of the response headers to the browser.

Inherited from
LaravelResponse

Tags

None found

header()

header(string  $name, string  $value) : \Laravel\Response

Add a header to the array of response headers.

Parameters

string $name
string $value

Returns

LaravelResponse

Inherited from
LaravelResponse

Tags

None found

headers()

headers() : \Laravel\ResponseParameterBag

Get the HttpFoundation Response headers.

Returns

LaravelResponseParameterBag

Inherited from
LaravelResponse

Tags

None found

status()

status(integer  $status = null) : mixed

Get / set the response status code.

Parameters

integer $status

Returns

mixed

Inherited from
LaravelResponse

Tags

None found

__toString()

__toString() : string

Render the response when cast to string

Returns

string

Inherited from
LaravelResponse

Tags

None found

home()

home(integer  $status = 302, boolean  $https = null) : \Laravel\Redirect

Create a redirect response to application root.

Parameters

integer $status
boolean $https

Returns

LaravelRedirect

static

Tags

None found

back()

back(integer  $status = 302) : \Laravel\Redirect

Create a redirect response to the HTTP referrer.

Parameters

integer $status

Returns

LaravelRedirect

static

Tags

None found

to()

to(string  $url, integer  $status = 302, boolean  $https = null) : \Laravel\Redirect

Create a redirect response.

// Create a redirect response to a location within the application return Redirect::to('user/profile');

// Create a redirect response with a 301 status code
return Redirect::to('user/profile', 301);

Parameters

string $url
integer $status
boolean $https

Returns

LaravelRedirect

static

Tags

None found

to_secure()

to_secure(string  $url, integer  $status = 302) : \Laravel\Redirect

Create a redirect response to a HTTPS URL.

Parameters

string $url
integer $status

Returns

LaravelRedirect

static

Tags

None found

to_action()

to_action(string  $action, array  $parameters = array(), integer  $status = 302) : \Laravel\Redirect

Create a redirect response to a controller action.

Parameters

string $action
array $parameters
integer $status

Returns

LaravelRedirect

static

Tags

None found

to_route()

to_route(string  $route, array  $parameters = array(), integer  $status = 302) : \Laravel\Redirect

Create a redirect response to a named route.

// Create a redirect response to the "login" named route return Redirect::to_route('login');

// Create a redirect response to the "profile" named route with parameters
return Redirect::to_route('profile', array($username));

Parameters

string $route
array $parameters
integer $status

Returns

LaravelRedirect

static

Tags

None found

with()

with(string  $key, mixed  $value) : \Laravel\Redirect

Add an item to the session flash data.

This is useful for "passing" status messages or other data to the next request.

// Create a redirect response and flash to the session return Redirect::to('profile')->with('message', 'Welcome Back!');

Parameters

string $key
mixed $value

Returns

LaravelRedirect

Tags

None found

with_input()

with_input(string  $filter = null, array  $items = array()) : \Laravel\Redirect

Flash the old input to the session and return the Redirect instance.

Once the input has been flashed, it can be retrieved via the Input::old method.

// Redirect and flash all of the input data to the session return Redirect::to('login')->with_input();

// Redirect and flash only a few of the input items
return Redirect::to('login')->with_input('only', array('email', 'username'));

// Redirect and flash all but a few of the input items
return Redirect::to('login')->with_input('except', array('password', 'ssn'));

Parameters

string $filter
array $items

Returns

LaravelRedirect

Tags

None found

with_errors()

with_errors(\Laravel\Validator|\Laravel\Messages  $container) : \Laravel\Redirect

Flash a Validator's errors to the session data.

This method allows you to conveniently pass validation errors back to views.

// Redirect and flash validator errors the session return Redirect::to('register')->with_errors($validator);

Parameters

LaravelValidator|LaravelMessages $container

Returns

LaravelRedirect

Tags

None found

cookies()

cookies() : void

Set the cookies on the HttpFoundation Response.

Inherited from
LaravelResponse

Tags

None found