trait HasSlug (View source)

Properties

array $twillSlugData

Methods

static void
bootHasSlug()

No description

HasMany
slugs()

Defines the one-to-many relationship for slug objects.

string
getSlugClass()

Returns an instance of the slug class for this model.

string
getSlugModelClass()

Returns the fully qualified slug class name for this model.

string
getSlugClassName()

No description

Builder
scopeForSlug(Builder $query, string $slug)

No description

Builder
scopeForInactiveSlug(Builder $query, string $slug)

No description

Builder
scopeForFallbackLocaleSlug(Builder $query, string $slug)

No description

void
setSlugs()

No description

void
restoreSlugs()

No description

void
handleSlugsOnSave()

When a new model is created there is more than one language, we generate the slugs where there is no locale variant yet based on the source.

void
updateOrNewSlug(array $slugParams)

No description

Model|null
getExistingSlug(array $slugParams, bool $forRecreate = false)

No description

void
addOneSlug(array $slugParams)

No description

void
disableLocaleSlugs(string $locale, int $except_slug_id = 0)

No description

Model|null
getActiveSlug(string|null $locale = null)

Returns the active slug object for this model.

Model|null
getFallbackActiveSlug()

Returns the fallback active slug object for this model.

string
getSlug(string|null $locale = null)

Returns the active slug string for this model.

string
getSlugAttribute()

No description

array|null
getSlugParams(string|null $locale = null)

No description

array|null
getSingleSlugParams(string|null $locale = null)

No description

string
getSlugsTable()

Returns the database table name for this model's slugs.

string
getForeignKey()

Returns the database foreign key column name for this model.

string|int
getSuffixSlug()

No description

string
getUtf8Slug(string $str, array $options = [])

Generate a URL friendly slug from a UTF-8 string.

string
urlSlugShorter(string $string)

Generate a URL friendly slug from a given string.

string
getNamespace()

Returns the fully qualified namespace for this model.

Details

static protected void bootHasSlug()

No description

Return Value

void

HasMany slugs()

Defines the one-to-many relationship for slug objects.

Return Value

HasMany

string getSlugClass()

Returns an instance of the slug class for this model.

Return Value

string

string getSlugModelClass()

Returns the fully qualified slug class name for this model.

Return Value

string

protected string getSlugClassName()

No description

Return Value

string

Builder scopeForSlug(Builder $query, string $slug)

No description

Parameters

Builder $query
string $slug

Return Value

Builder

Builder scopeForInactiveSlug(Builder $query, string $slug)

No description

Parameters

Builder $query
string $slug

Return Value

Builder

Builder scopeForFallbackLocaleSlug(Builder $query, string $slug)

No description

Parameters

Builder $query
string $slug

Return Value

Builder

void setSlugs()

No description

Return Value

void

void restoreSlugs()

No description

Return Value

void

void handleSlugsOnSave()

When a new model is created there is more than one language, we generate the slugs where there is no locale variant yet based on the source.

Return Value

void

void updateOrNewSlug(array $slugParams)

No description

Parameters

array $slugParams

Return Value

void

Model|null getExistingSlug(array $slugParams, bool $forRecreate = false)

No description

Parameters

array $slugParams
bool $forRecreate

Return Value

Model|null

protected void addOneSlug(array $slugParams)

No description

Parameters

array $slugParams

Return Value

void

void disableLocaleSlugs(string $locale, int $except_slug_id = 0)

No description

Parameters

string $locale
int $except_slug_id

Return Value

void

Model|null getActiveSlug(string|null $locale = null)

Returns the active slug object for this model.

Parameters

string|null $locale

Return Value

Model|null

Model|null getFallbackActiveSlug()

Returns the fallback active slug object for this model.

Return Value

Model|null

string getSlug(string|null $locale = null)

Returns the active slug string for this model.

Parameters

string|null $locale

Return Value

string

string getSlugAttribute()

No description

Return Value

string

array|null getSlugParams(string|null $locale = null)

No description

Parameters

string|null $locale

Return Value

array|null

array|null getSingleSlugParams(string|null $locale = null)

No description

Parameters

string|null $locale

Return Value

array|null

string getSlugsTable()

Returns the database table name for this model's slugs.

Return Value

string

string getForeignKey()

Returns the database foreign key column name for this model.

Return Value

string

protected string|int getSuffixSlug()

No description

Return Value

string|int

string getUtf8Slug(string $str, array $options = [])

Generate a URL friendly slug from a UTF-8 string.

Parameters

string $str
array $options

Return Value

string

string urlSlugShorter(string $string)

Generate a URL friendly slug from a given string.

Parameters

string $string

Return Value

string

string getNamespace()

Returns the fully qualified namespace for this model.

Return Value

string