Example #1
0
    Route::get('preview-list', array('as' => 'previewList', 'uses' => 'ListController@previewList'));
    //My profile
    Route::get('me', array('as' => 'myProfile', 'uses' => 'UserController@myProfile'));
    Route::match(array('get', 'post'), 'me/settings', array('as' => 'myProfileSettings', 'uses' => 'UserController@myProfileSettings'));
});
Route::get('pages/{nameString}.html', array('as' => 'viewPage', 'uses' => 'PageController@viewPage'));
Route::get('category/{slug}', array('as' => 'category', 'uses' => 'ListController@category'));
$admin = Session::get('admin');
View::share('loggedInAdmin', $admin);
App::singleton('loggedInAdmin', function () use($admin) {
    return $admin;
});
Route::filter('adminAuth', function () {
    $admin = Session::get('admin');
    //Populate view with common data for admins
    AdminBaseController::populateView();
    /*if (!$admin && !Input::get('logmein'))
      {
          return Response::notFound();
      } else */
    if (!$admin) {
        if (Request::ajax()) {
            return Response::make('You have been logged out or your session has expired. Please login on another tab and try again.<br><br><a target="_blank" href="' . route('adminLogin') . '" class="btn btn-success">Login again</a></a>', 400);
        } else {
            return Redirect::route('adminLogin', ['redirect' => urlencode(Request::path())]);
        }
    }
});
Route::match(array('get', 'post'), 'admin/login', array('as' => 'adminLogin', 'uses' => 'AdminController@login'));
Route::get('admin/logout', array('as' => 'adminLogout', 'uses' => 'AdminController@logout'));
Route::group(array('before' => 'adminAuth'), function () {