Skip to content

Commit d75b6ce

Browse files
committed
Add: function to call model
1 parent efb4517 commit d75b6ce

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

system/support/common.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ function show_403() {
6363
die;
6464
}
6565

66+
function model(string $model) {
67+
if(file_exists($path = APPPATH . "/models/$model.php")) {
68+
require $path;
69+
} else {
70+
throw new Exception("Model $model is not found");
71+
}
72+
}
73+
6674
function view(string $view, array $params = []) {
6775
extract($params);
6876
if(file_exists($path = APPPATH . "/views/$view.php")) {

0 commit comments

Comments
 (0)