Skip to content

Commit

Permalink
Merge branch 'cookiejar' of https://github.com/jonnybarnes/docs into …
Browse files Browse the repository at this point in the history
…jonnybarnes-cookiejar
  • Loading branch information
taylorotwell committed Mar 25, 2015
2 parents 4c3d1b1 + db84244 commit 728c7a7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,30 @@ _By "forever", we really mean five years._

$response->withCookie(cookie()->forever('name', 'value'));

#### Queueing Cookies

We can also queue a cookie using Laravel’s `CookieJar`. Queued cookies are automatically added to a subsequent response.

<?php namespace App\Http\Controllers;

use Illuminate\Cookie\CookieJar;
use Illuminate\Routing\Controller;
use Illuminate\Http\Response;

class UserController extends Controller
{
/**
* Update a resource
*
* @param \Illuminate\Cookie\CookieJar $cookie
*/
public function update(CookieJar $cookie)
{
$cookie->queue('name', 'value', $minutes);
return (new Response($content, 200));
}
}

<a name="files"></a>
## Files

Expand Down

0 comments on commit 728c7a7

Please sign in to comment.