In Laravel 4. I am trying to set the specific header to my route.
I have
Route::filter('api', function($response){
$response->header("Access-Control-Allow-Origin","*");
if (Input::get('key') != 'bheng')
{
return Response::view('errors.404', array(), 404);
}
});
I kept getting
Call to undefined method Illuminate\Routing\Route::header()
I'm trying to set it, so I don't get the CORS error anymore.
Any hint on that will be greatly appreciated !!!
Based on Laravel documentation
After filters receive a $response as the third argument passed to the filter
Route::filter('log', function($route, $request, $response)
{
//
})