eee
This commit is contained in:
+6
-1
@@ -52,12 +52,17 @@ abstract class HasBase implements \Database\Traits\Relation
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param array $arguments
|
* @param array $arguments
|
||||||
* @return $this|mixed
|
* @return $this|mixed
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function __call(string $name, array $arguments)
|
public function __call(string $name, array $arguments)
|
||||||
{
|
{
|
||||||
if ($name !== 'get') {
|
if ($name !== 'get') {
|
||||||
$relation = Kiri::getDi()->get(Relation::class);
|
$relation = Kiri::getDi()->get(Relation::class);
|
||||||
$relation->getQuery($this->name)->$name(...$arguments);
|
$query = $relation->getQuery($this->name);
|
||||||
|
if (is_null($query)) {
|
||||||
|
throw new \Exception('Unknown relation method: ' . $name);
|
||||||
|
}
|
||||||
|
$query->$name(...$arguments);
|
||||||
return $this;
|
return $this;
|
||||||
} else {
|
} else {
|
||||||
return $this->get();
|
return $this->get();
|
||||||
|
|||||||
Reference in New Issue
Block a user