getQuery($this->name); if (is_null($query)) { throw new \Exception('Unknown relation key: ' . $this->name); } $query->$name(...$arguments); return $this; } else { return $this->get(); } } /** * @param string $name * @return mixed */ public function __get(string $name): mixed { if ($this->data === null) { $this->data = $this->get(); } return $this->data; } }