Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function create(string $name): Model |
||
38 | { |
||
39 | // Try to load specific model class first if modelNamespace is not empty |
||
40 | $namespace = $this->config->getModelNamespace(); |
||
41 | if (!empty($namespace)) { |
||
42 | $modelClass = $namespace.ucfirst($name); |
||
43 | if (class_exists($modelClass)) { |
||
44 | return $this->container->make($modelClass); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | // Fallback to generic model with table name |
||
49 | return $this->container->make(Model::class, ['table' => $name]); |
||
50 | } |
||
52 |