query)) { $this->query = $this->thread->query(); } /** @var Collection $data */ $data = $this->query->with($with)->get(); if(is_null($data)) { return null; } return $this->return == 'Model' ? $data->first() : $data; } /** * @param $uuid * @param array $with * @return Collection|Thread|null */ public function byUuid($uuid, array $with = []): Collection|Thread|null { $this->return = 'Model'; $this->query = $this->thread->query()->where('uuid', $uuid); return $this->run($with); } /** * @param $slug * @param array $with * @return Collection|Thread|null */ public function bySlug($slug, array $with = []): Collection|Thread|null { $this->return = 'Model'; $this->query = $this->thread->query()->where('slug', $slug); return $this->run($with); } }