06.10.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

HTTP Responses 160<br />

17 Cookie::queue('saw_dashboard', true, 15);<br />

18<br />

19 return view('dashboard');<br />

20 }<br />

21 }<br />

In this example, the saw_dashboard cookie will automatically be added to the outgoing response<br />

without forcing you to manually attach the cookie to a specific response instance.<br />

Cookies & Encryption<br />

By default, all cookies generated by Laravel are encrypted and signed so that they can’t be modified<br />

or read by the client. If you would like to disable encryption for a certain subset of cookies generated<br />

by your application, you may use the $except property of the App\Http\Middleware\EncryptCookies<br />

middleware:<br />

1 /**<br />

2 * The names of the cookies that should not be encrypted.<br />

3 *<br />

4 * @var array<br />

5 */<br />

6 protected $except = [<br />

7 'cookie_name',<br />

8 ];<br />

Other Response Types<br />

The response helper may be used to conveniently generate other types of response instances. When<br />

the response helper is called without arguments, an implementation of the Illuminate\Contracts\Routing\Respon<br />

contract is returned. This contract provides several helpful methods for generating responses.<br />

View Responses<br />

If you need control over the response status and headers, but also need to return a view as the<br />

response content, you may use the view method:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!