diff --git a/app/core/App.php b/app/core/App.php index f130c68..f273a46 100644 --- a/app/core/App.php +++ b/app/core/App.php @@ -21,12 +21,15 @@ class App } // Grab model - public function model(string $model): object + public function model(string $model, $injection = NULL): object { // Require model file require __DIR__ . '/../model/' . $model . '.php'; // Instantiate model - return new $model(); + if (!$injection) { + $injection = $this->database; + } + return new $model($injection); } // Render given view