Isswp101\Persimmon\Relationship\HasManyRelationship::get PHP Method

get() public method

Find all children.
public get ( ) : ElasticsearchCollection | ElasticsearchModel[]
return Isswp101\Persimmon\Collection\ElasticsearchCollection | Isswp101\Persimmon\ElasticsearchModel[]
    public function get()
    {
        $child = $this->childClassName;
        $query = new QueryBuilder();
        $query->filter(new ParentFilter($this->parent->getId()));
        $collection = $child::search($query);
        $collection->each(function (ElasticsearchModel $model) {
            $model->setParent($this->parent);
        });
        return $collection;
    }