public function __get($key) { static $collections = ['speakers', 'sponsors', 'communitySponsors', 'talks', 'rooms', 'hotels', 'jobs', 'individualSponsors']; if (in_array($key, $collections, true)) { $data = $this->database->get($key); foreach ($data as &$item) { $item = new Model($item, $this->database); } return new Collection($data); } return parent::__get($key); }