Пример #1
0
 /**
  * @param int $parent_id
  * @return static
  */
 public function getSubCategories($parent_id = 0)
 {
     if (!$parent_id) {
         $parent_id = $this->attributes['id'];
     }
     $count = parent::whereEnabled(true)->whereParentId($parent_id)->count();
     if ($count) {
         return parent::whereEnabled(true)->whereParentId($parent_id)->get();
     } else {
         return Collection::make();
     }
 }
Пример #2
0
 /**
  * @return mixed
  */
 public function getSubMenus()
 {
     return parent::whereEnabled(true)->whereGroupId($this->attributes['group_id'])->whereParentId($this->attributes['id'])->orderBy('order_id')->get();
 }