/** * Execute the query and get the first result. * * @return mixed */ public function first() { if ($entity = $this->manager->hydrateOne($this->query->limit(1)->execute(), $this->metadata)) { foreach ($this->getRelations() as $name => $query) { $this->manager->related($entity, $name, $query); } return $entity; } return null; }