/**
  * URL: /
  */
 public function index($data)
 {
     $model = new LoginModel();
     if (!$model->isLoggedIn()) {
         header('location: ' . URL_LOGIN);
         exit;
     }
 }
 /**
  * URL: /login/oauth2
  *
  * This is the route the google will send the resonce code to.
  */
 public function oauth2($data)
 {
     $model = new Model();
     $model->checkRedirectCode();
     // if exception is thrown, it caught at the top level of app
     header('location: ' . URL);
     exit;
 }
require 'config.php';
require __DIR__ . '/../vendor/autoload.php';
// Autoloader
require PATH_LIBRARIES . 'slaymaster3000/airbase-php/vendor/autoload.php';
// AirBase autoloader
use AirBase\AirBase;
use AirBase\Session;
use AirBase\Bootstrap;
use AirBase\PageNotFoundException;
use AirBase\NotLoggedInException;
use AirBase\NotLoggedOutException;
use GrandTraining\admin\models\Login as LoginModel;
// init the lib library
AirBase::init();
AirBase::setIsLoggedInFunction(function () {
    return LoginModel::isLoggedIn();
});
try {
    Session::start();
    // start a session
    $bootstrap = new Bootstrap(NAMESPACE_CONTROLLERS, PATH_CONTROLLERS, 'url');
    // process the request
} catch (PageNotFoundException $e) {
    if (AirBase::isLoggedIn()) {
        require PATH_ERROR_PAGES . '404.php';
    }
    header('location: ' . URL);
    // always redirect to the home page if not logged in
    exit;
} catch (NotLoggedInException $e) {
    header('location: ' . URL_LOGIN);