PHP Class Cviebrock\EloquentSluggable\Services\SlugService

Afficher le fichier Open project: cviebrock/eloquent-sluggable Class Usage Examples

Protected Properties

Свойство Type Description
$model Illuminate\Database\Eloquent\Model;

Méthodes publiques

Méthode Description
buildSlug ( string $attribute, array $config, boolean $force = null ) : null | string Build the slug for the given attribute of the current model.
createSlug ( Model | string $model, string $attribute, string $fromString, array $config = null ) : string Generate a unique slug for a given string.
getConfiguration ( array $overrides = [] ) : array Get the sluggable configuration for the current model, including default values where not specified.
setModel ( Model $model )
slug ( Model $model, boolean $force = false ) : boolean Slug the current model.

Méthodes protégées

Méthode Description
generateSlug ( string $source, array $config, string $attribute ) : string Generate a slug from the given source string.
generateSuffix ( string $slug, string $separator, Collection $list ) : string Generate a unique suffix for the given slug (and list of existing, "similar" slugs.
getExistingSlugs ( string $slug, string $attribute, array $config ) : Collection Get all existing slugs that are similar to the given slug.
getSlugEngine ( string $attribute ) : Slugify Return a class that has a slugify() method, used to convert strings into slugs.
getSlugSource ( mixed $from ) : string Get the source string for the slug.
makeSlugUnique ( string $slug, array $config, string $attribute ) : string Checks if the slug should be unique, and makes it so if needed.
needsSlugging ( string $attribute, array $config ) : boolean Determines whether the model needs slugging.
usesSoftDeleting ( ) : boolean Does this model use softDeleting?
validateSlug ( string $slug, array $config, string $attribute ) : string Checks that the given slug is not a reserved word.

Method Details

buildSlug() public méthode

Build the slug for the given attribute of the current model.
public buildSlug ( string $attribute, array $config, boolean $force = null ) : null | string
$attribute string
$config array
$force boolean
Résultat null | string

createSlug() public static méthode

Generate a unique slug for a given string.
public static createSlug ( Model | string $model, string $attribute, string $fromString, array $config = null ) : string
$model Illuminate\Database\Eloquent\Model | string
$attribute string
$fromString string
$config array
Résultat string

generateSlug() protected méthode

Generate a slug from the given source string.
protected generateSlug ( string $source, array $config, string $attribute ) : string
$source string
$config array
$attribute string
Résultat string

generateSuffix() protected méthode

Generate a unique suffix for the given slug (and list of existing, "similar" slugs.
protected generateSuffix ( string $slug, string $separator, Collection $list ) : string
$slug string
$separator string
$list Illuminate\Support\Collection
Résultat string

getConfiguration() public méthode

Get the sluggable configuration for the current model, including default values where not specified.
public getConfiguration ( array $overrides = [] ) : array
$overrides array
Résultat array

getExistingSlugs() protected méthode

Get all existing slugs that are similar to the given slug.
protected getExistingSlugs ( string $slug, string $attribute, array $config ) : Collection
$slug string
$attribute string
$config array
Résultat Illuminate\Support\Collection

getSlugEngine() protected méthode

Return a class that has a slugify() method, used to convert strings into slugs.
protected getSlugEngine ( string $attribute ) : Slugify
$attribute string
Résultat Cocur\Slugify\Slugify

getSlugSource() protected méthode

Get the source string for the slug.
protected getSlugSource ( mixed $from ) : string
$from mixed
Résultat string

makeSlugUnique() protected méthode

Checks if the slug should be unique, and makes it so if needed.
protected makeSlugUnique ( string $slug, array $config, string $attribute ) : string
$slug string
$config array
$attribute string
Résultat string

needsSlugging() protected méthode

Determines whether the model needs slugging.
protected needsSlugging ( string $attribute, array $config ) : boolean
$attribute string
$config array
Résultat boolean

setModel() public méthode

public setModel ( Model $model )
$model Illuminate\Database\Eloquent\Model

slug() public méthode

Slug the current model.
public slug ( Model $model, boolean $force = false ) : boolean
$model Illuminate\Database\Eloquent\Model
$force boolean
Résultat boolean

usesSoftDeleting() protected méthode

Does this model use softDeleting?
protected usesSoftDeleting ( ) : boolean
Résultat boolean

validateSlug() protected méthode

Checks that the given slug is not a reserved word.
protected validateSlug ( string $slug, array $config, string $attribute ) : string
$slug string
$config array
$attribute string
Résultat string

Property Details

$model protected_oe property

protected Model;,Illuminate\Database\Eloquent $model
Résultat Illuminate\Database\Eloquent\Model;