getBreadcrumbs() 공개 메소드

get breadcrumbs
public getBreadcrumbs ( ) : array
리턴 array
예제 #1
0
 /**
  * Get primary key array for breadcrumbs
  *
  * @return array
  */
 public function getBreadcrumbs()
 {
     if ($this->parent) {
         return array_merge($this->parent->getBreadcrumbs(), [$this->getKey()]);
     }
     return $this->ancestors->sort(function ($a, $b) {
         $aDepth = $a->pivot->{$this->getDepthName()};
         $bDepth = $b->pivot->{$this->getDepthName()};
         if ($aDepth == $bDepth) {
             return 0;
         }
         return $aDepth > $bDepth ? -1 : 1;
     })->push($this)->pluck($this->getKeyName())->toArray();
 }