atayahmet / laravel-nestable

Laravel 5 nested category/menu generator
MIT License
214 stars 52 forks source link

where is breadcrumb option, how i can retrieve parents of child? #16

Closed knour89 closed 7 years ago

knour89 commented 7 years ago

hello i want to inverse the hierarchy, since each child can have one parent, how i can retrieve the breadcrumb (parents) of a child?

-Electornic --Computer and tablet ---Computer (want get parent of computer as below)

i want below Compiter > Computers and Tablets > Electronic

atayahmet commented 7 years ago

Hi @knour89

This package only exports array, json and html snippets. Unfortunately inverse hierarchy is not supports. But for now. If give me little bit time, i will can add your asked feature. Of course, if this feature is urgent you can find another very usefully packages.

Most known: laravel-breadcrumbs

knour89 commented 7 years ago

thx for your respond, i will w8 for your new update.. welcome from egypt and slamo alikom bro

atayahmet commented 7 years ago

Your welcome. Alikom slamo brother.

johannesschobel commented 7 years ago

i will take a look at this issue this / next week.. i will contribute to this package by providing different URIs for the categories and then fix this issue as well..

kjareena commented 6 years ago

Hi @knour89 atayahmet

I am waiting for your reply. Please suggest me ASAP.

MiselAdemi commented 6 years ago

Here is my solution function for breadcrumb:

protected $parents = array();

public function parent_cat($cat) {
      if ($cat->parent_id > 0) {
        $this->parents[] = Category::find($cat->parent_id);
        self::parent_cat(Category::find($cat->parent_id));
      }
      return $this->parents;
    }
kjareena commented 6 years ago

Thanks