Add inject to App::model
This commit is contained in:
		
							parent
							
								
									84434a4b00
								
							
						
					
					
						commit
						321ce8ae45
					
				| @ -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
 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user