Skip to content

Call to undefined method immediateDescendants() #326

Open

Description

@kheengz

Laravel: 6.0
Baum: 2.0.0-alpha1

i had to check the codebase and i realized that some portion of codes were commented out. actually this bit here https://github.com/etrepat/baum/blob/v2/src/NestedSet/Concerns/Relatable.php#L27-L45

    // /**
    //  * Inmmediate descendants relation. Alias for "children".
    //  *
    //  * @return \Illuminate\Database\Eloquent\Relations\HasMany
    //  */
    // public function immediateDescendants()
    // {
    //     return $this->children();
    // }
    // /**
    //  * Attribute alias so as to eager-load the proper relationship.
    //  *
    //  * @return mixed
    //  */
    // public function getImmediateDescendantsAttribute()
    // {
    //     return $this->getRelationValue('children');
    // }

the way i was able to get around this challenges were to override that function or rather duplicate it into my own class that inherited the Buam/Node by doing this below.

      /**
      * Inmmediate descendants relation. Alias for "children".
      *
      * @return \Illuminate\Database\Eloquent\Relations\HasMany
      */
     public function immediateDescendants()
     {
         return $this->children();
     }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions