Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method immediateDescendants() #326

Open
kheengz opened this issue Nov 21, 2019 · 0 comments
Open

Call to undefined method immediateDescendants() #326

kheengz opened this issue Nov 21, 2019 · 0 comments

Comments

@kheengz
Copy link

kheengz commented Nov 21, 2019

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();
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant