Laravel: Prevent Sessions for Routes via a Filter
I needed to prevent Laravel from using sessions for a few API endpoints in an app, this is how I did it:
Route::filter('session.remove', function()
{
return Config::set('session.driver', 'array');
});
This can be used quite easily with a route or route group:
Route::group(array(
"prefix" => "api/v1",
"before" => array("session.remove")
), function() {
Route::get('/search', 'SearchController@getPerformSearch');
});