add static method to get inherited class querybuilder from model, add isset method in model

This commit is contained in:
Gregory Letellier
2023-11-13 09:01:51 +01:00
parent 523d307f81
commit bdb0a88e58
2 changed files with 41 additions and 1 deletions

View File

@@ -121,6 +121,21 @@ class Model
}
}
public function __isset($name): bool
{
if (method_exists($this, $name)) {
return true;
} else {
return isset($this->values[$name]);
}
}
public static function q(): QueryBuilder
{
$ist = new static();
return $ist->newQueryBuilder();
}
public function __get($name): mixed
{
if (isset($this->values[$name])) {