<?php


namespace App\Providers;

use \Phroute\Phroute\RouteCollector;
use \Phroute\Phroute\Dispatcher;
use \Exception;
use \App\Providers\Shared;

/**
*
*/
class Auth
{
    public static function IsLogin()
    {
        if ( !isset($_SESSION['admin']['username']) || empty($_SESSION['admin']['username']) ) {
           return false;
        }
        return true;
    }

    public static function BlockVisitor()
    {
        if ( !isset($_SESSION['admin']['username']) ) {
             return Shared::Redirect( $_ENV['BASE_URL'] . 'login' );
        }
    }

    public static function BlockConnected()
    {
        if ( isset($_SESSION['admin']['username']) ) {
            return Shared::Redirect( $_ENV['BASE_URL'] . 'dashboard' );
        }
    }


}
