hasMany(self::class,'parent_id'); } /** * Return all the children RTM records that this record is parent of * * @return Collection */ public function children_all(): Collection { $result = collect(); $result->push($this->withoutRelations()); foreach ($this->children as $o) $result = $result->merge($o->children_all()); return $result; } }