I want to do something like this:
return Response::view('survey.do')
//->with('theme',$survey->theme);
->header('Cache-Control', 'no-cache, must-revalidate')
->header('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
It says it can't find the theme definition in the view, problem is when i do:
View::make('survey.do')->with('theme',$survey->theme)
It does work but I can't access the http response
header, how can I achieve this?
Instead of using with
and header
pass arrays like this:
$data = array('theme' => $survey->theme);
$headres = array(
'Cache-Control' => 'no-cache, must-revalidate',
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT'
);
return Response::view('survey.do', $data, '200', $headres);
This will work because this is the method signature/header in the Response
class (Facade):
public static function view($view, $data = array(), $status = 200, array $headers = array())
In this case, it calls the make
method of that class which is as follows:
public static function make($content = '', $status = 200, array $headers = array())
{
return new IlluminateResponse($content, $status, $headers);
}