// The user is logged in return View::make('editor'); } else { return View::make('landing'); } }); // Routes that only respond to logged-in requests Route::group(array('prefix' => 'api', 'before' => 'auth.api'), function () { Route::any('maps', function () { $output = array(); $output['maps'] = Auth::user()->viewableMaps()->toArray(); return Response::json($output); }); Route::controller('map/{mapid}', 'MapController'); Route::post('map/create', function () { $map_id = MapController::create(); return Response::json(array('id' => $map_id)); }); }); Route::get('logout', function () { Auth::logout(); return Redirect::to('/')->with('loggedout', true); }); /** * Facebook */ Route::get('login/fb', function () { // Sometimes the user comes from #mapid-X and want to end up there later if (Input::has('loadmap')) { $mapToGoBackTo = intval(Input::get('loadmap')); Session::put('loadmap', $mapToGoBackTo);