Is this a filter order issue? In the first filter I set up a object needed for authentication (later),
global $edgeApp;
Route::filter('connect', function() {
global $edgeApp;
$edgeApp = new BillMax\EdgeApp;
$edgeApp->login();
});
Route::when('secure/*', 'connect');
In the second filter (on the same path), the redirect is a login page.
Route::filter('auth', function() {
if (Auth::guest()) {
if (Request::ajax()) {
return Response::make('Unauthorized', 401);
} else {
return Redirect::guest('login');
}
}
});
Route::when('secure/*', 'auth');
Which is display via:
return View::make('login', array('edgeApp' => $GLOBALS['edgeApp']) );
The trouble is the $edgeApp variable is NULL when the login template is rendered. What am I doing wrong?
B
Please ignore, The issue was the redirect generates a new request where the EdgeApp obj was not initialized.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community