Jobs/RegenerateCategoryFullSlugs.php
private function setCategoryFullSlug(Category $category): void
    {
        static $languages;

        if (! $languages) {
            $languages = $this->language ? [$this->language] : TransHelper::getAllLanguages();
        }

        foreach ($languages as $language) {
            $category->translations()->where('locale', $language->iso_code)->update([
                'full_slug' => $this->getSlugForCategory($category->id, $language->iso_code),
            ]);
        }

        foreach ($category->descendants()->get() as $descendant) {
            foreach ($languages as $language) {
                $descendant->translations()->where('locale', $language->iso_code)->update([
                    'full_slug' => $this->getSlugForCategory($descendant->id, $language->iso_code),
                ]);
            }
        }
    }
private function setCategoryFullSlug(Category $category): void
    {
        static $languages;

        if (! $languages) {
            $languages = $this->language ? [$this->language] : TransHelper::getAllLanguages();
        }

        foreach ($languages as $language) {
            $category->translations()->where('locale', $language->iso_code)->update([
                'full_slug' => $this->getSlugForCategory($category->id, $language->iso_code),
            ]);
        }

        foreach ($category->descendants()->get() as $descendant) {
            foreach ($languages as $language) {
                $descendant->translations()->where('locale', $language->iso_code)->update([
                    'full_slug' => $this->getSlugForCategory($descendant->id, $language->iso_code),
                ]);
            }
        }
    }
private function setCategoryFullSlug ( Category $ category ) : void { static $ languages ; if ( ! $ languages ) { $ languages = $ this -> language ? [ $ this -> language ] : TransHelper :: getAllLanguages ( ) ; } foreach ( $ languages as $ language ) { $ category -> translations ( ) -> where ( 'locale' , $ language -> iso_code ) -> update ( [ 'full_slug' => $ this -> getSlugForCategory ( $ category -> id , $ language -> iso_code ) , ] ) ; } foreach ( $ category -> descendants ( ) -> get ( ) as $ descendant ) { foreach ( $ languages as $ language ) { $ descendant -> translations ( ) -> where ( 'locale' , $ language -> iso_code ) -> update ( [ 'full_slug' => $ this -> getSlugForCategory ( $ descendant -> id , $ language -> iso_code ) , ] ) ; } } }
Generate full slug for category

@param Category $category
@return void
Generate full slug for category