public function getUrlAttribute()
    {
        $url = '';

        foreach (array_reverse($this->getAncestors()->all()) as $parent) {
            $url = '/'.$parent->slug.$url;
        }

        return "/buy$url/".$this->slug;
    }
public function getUrlAttribute()
    {
        $url = '';

        foreach (array_reverse($this->getAncestors()->all()) as $parent) {
            $url = '/'.$parent->slug.$url;
        }

        return "/buy$url/".$this->slug;
    }
public function getUrlAttribute ( ) { $ url = '' ; foreach ( array_reverse ( $ this -> getAncestors ( ) -> all ( ) ) as $ parent ) { $ url = '/' . $ parent -> slug . $ url ; } return "/buy$url/" . $ this -> slug ; }
Override the parent's url attribute.

@return string
Override the parent s url attribute .