Contents

October\Rain\Database\Traits\SluggableTree

Overview

SluggableTree trait creates structured slugs, called full slugs. Calculating full slugs must be performed externally since it involves expensive lookups. The model is assumed to have two relations defined: parent, children.


Public Methods

public fullSlugAttributes()

public fullSlugAttributes(): void 

fullSlugAttributes calculates full slugs for this model and all descendants

public getFullSluggableFullSlugColumnName()

public getFullSluggableFullSlugColumnName(): string 

getFullSluggableFullSlugColumnName gets the name of the "fullslug" column.

public getFullSluggableSlugColumnName()

public getFullSluggableSlugColumnName(): string 

getFullSluggableSlugColumnName gets the name of the "slug" column.

Protected Methods

protected getFullSluggableAttributeValue()

protected getFullSluggableAttributeValue($model, $fullslug = ''): void

getFullSluggableAttributeValue builds the fullslug by walking up the parent chain using the model's slug attribute

protected getFullSluggableTranslatedAttributeValue()

protected getFullSluggableTranslatedAttributeValue(
    $model,
    $locale,
    $fullslug = ''
): void

getFullSluggableTranslatedAttributeValue builds the fullslug for a locale by walking up the parent chain, falling back to default slugs when untranslated

protected getFullSluggableTranslatedLocales()

protected getFullSluggableTranslatedLocales($model): void

getFullSluggableTranslatedLocales returns locales with slug translations on the model or any of its ancestors

protected setFullSluggedTranslatedValues()

protected setFullSluggedTranslatedValues($model): void

setFullSluggedTranslatedValues recomputes the fullslug for every locale with slug translations on the model or its ancestor chain

protected setFullSluggedValue()

protected setFullSluggedValue($model): void

setFullSluggedValue will set the fullslug value on a model and recurse into children. For translatable models, the Translatable trait intercepts attribute access for the active locale automatically.