app\models\Article::getFullUrlAttribute PHP Method

getFullUrlAttribute() public method

public getFullUrlAttribute ( ) : string
return string
    public function getFullUrlAttribute() : string
    {
        $localeSegment = '';
        if (locales()->count() > 1) {
            $localeSegment = '/' . locale();
        }
        if ($this->technical_name === SpecialArticle::HOME) {
            return $localeSegment;
        }
        $parentUrl = $this->hasParent() ? $this->parent->url . '/' : '';
        return "{$localeSegment}/{$parentUrl}{$this->url}";
    }