I'm using the latest version of Laravel 4 and I can't set cookies:
Route::get('cookietest', function()
{
Cookie::forever('forever', 'Success');
$forever = Cookie::get('forever');
Cookie::make('temporary', 'Victory', 5);
$temporary = Cookie::get('temporary');
return View::make('cookietest', array('forever' => $forever, 'temporary' => $temporary, 'variableTest' => 'works'));
});
View script:
@extends('layouts.master')
@section('content')
Forever cookie: {{ $forever }} <br />
Temporary cookie: {{ $temporary }} <br />
Variable test: {{ $variableTest }}
@stop
Yields:
Forever cookie:
Temporary cookie:
Variable test: works
It doesn't matter if I refresh the page or create the cookies in one route and try to access them in another. I can confirm that no cookies are being set with the above operation. The cookies 'laravel_payload' and 'laravel_session' as well as 'remember_[HASH]' do exist and I can set cookies with regular PHP using setcookie.
No errors are thrown or logged anywhere that I can find. I'm running Linux Mint locally and Debian on my server, both with nginx and I have the same problem in both places.