Bladeren bron

Fix Model and Manager

Visman 3 jaren geleden
bovenliggende
commit
f165e9fc00
2 gewijzigde bestanden met toevoegingen van 13 en 5 verwijderingen
  1. 11 3
      app/Models/Manager.php
  2. 2 2
      app/Models/Model.php

+ 11 - 3
app/Models/Manager.php

@@ -58,9 +58,15 @@ class Manager
      */
     public function __get(string $name) /* : mixed */
     {
-        $key = $this->cKey . '/' . $name;
+        $x = \ord($name);
+
+        if ($x > 90 || $x < 65) {
+            return null;
+        } else {
+            $key = $this->cKey . '/' . \lcfirst($name);
 
-        return $this->c->$key->setManager($this);
+            return $this->c->$key->setManager($this);
+        }
     }
 
     /**
@@ -68,6 +74,8 @@ class Manager
      */
     public function __call(string $name, array $args) /* : mixed */
     {
-        return $this->__get($name)->$name(...$args);
+        $key = $this->cKey . '/' . $name;
+
+        return $this->c->$key->setManager($this)->$name(...$args);
     }
 }

+ 2 - 2
app/Models/Model.php

@@ -143,9 +143,9 @@ class Model
         if ($x > 90 || $x < 65) {
             return null;
         } else {
-            $key = \str_replace(['ForkBB\\Models\\', 'ForkBB\\', '\\'], '', \get_class($this));
+            $key = $this->cKey . '/' . \lcfirst($name);
 
-            return $this->c->{$key . $name}->setModel($this);
+            return $this->c->$key->setModel($this);
         }
     }