trait HasSlug (View source)

Methods

static 
bootHasSlug()

No description

HasMany
slugs()

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

object
getSlugClass()

Returns an instance of the slug class for this model.

string|null
getSlugModelClass()

Returns the fully qualified slug class name for this model.

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(bool $restoring = false)

No description

void
updateOrNewSlug(array $slugParams, bool $restoring = false)

No description

object|null
getExistingSlug(array $slugParams)

No description

addOneSlug($slugParams)

No description

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

No description

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

Returns the active slug object for this model.

object|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.

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 bootHasSlug()

No description

HasMany slugs()

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

Return Value

HasMany

object getSlugClass()

Returns an instance of the slug class for this model.

Return Value

object

string|null getSlugModelClass()

Returns the fully qualified slug class name for this model.

Return Value

string|null

protected getSlugClassName()

No description

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(bool $restoring = false)

No description

Parameters

bool $restoring

Return Value

void

void updateOrNewSlug(array $slugParams, bool $restoring = false)

No description

Parameters

array $slugParams
bool $restoring

Return Value

void

object|null getExistingSlug(array $slugParams)

No description

Parameters

array $slugParams

Return Value

object|null

protected addOneSlug($slugParams)

No description

Parameters

$slugParams

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

No description

Parameters

string $locale
int $except_slug_id

Return Value

void

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

Returns the active slug object for this model.

Parameters

string|null $locale

Locale of the slug if your site has multiple languages.

Return Value

object|null

object|null getFallbackActiveSlug()

Returns the fallback active slug object for this model.

Return Value

object|null

string getSlug(string|null $locale = null)

Returns the active slug string for this model.

Parameters

string|null $locale

Locale of the slug if your site has multiple languages.

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 getSuffixSlug()

No description

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