Skip to content

Commit

Permalink
Allow BaseController to access instance of Nox
Browse files Browse the repository at this point in the history
  • Loading branch information
nox7 committed Apr 17, 2022
1 parent b9b924a commit b32af56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions example/nox-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
use Nox\Nox;
use Nox\ORM\Abyss;
use Nox\ORM\DatabaseCredentials;
use Nox\Router\BaseController;
use Nox\Router\Exceptions\NoMatchingRoute;

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/nox-env.php";

$nox = new Nox();
BaseController::$noxInstance = $nox;

// Set a static file serving directory
$nox->addStaticDirectory(
Expand Down
3 changes: 3 additions & 0 deletions src/Router/BaseController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php
namespace Nox\Router;

use Nox\Nox;

class BaseController{
public static Nox $noxInstance;
public static ?RequestHandler $requestHandler = null;

/**
Expand Down

0 comments on commit b32af56

Please sign in to comment.