PHP Trait Cviebrock\EloquentSluggable\SluggableScopeHelpers

Helper trait for defining the primary slug of a model and providing useful scopes and query methods.
Mostrar archivo Open project: cviebrock/eloquent-sluggable

Public Methods

Method Description
findBySlug ( string $slug, array $columns = ['*'] ) : Model | Illuminate\Database\Eloquent\Collection | static[] | static | null Find a model by its primary slug.
findBySlugOrFail ( string $slug, array $columns = ['*'] ) : Model | Illuminate\Database\Eloquent\Collection Find a model by its primary slug or throw an exception.
getSlugKey ( ) : string Primary slug value of this model.
getSlugKeyName ( ) : string Primary slug column of this model.
scopeWhereSlug ( Builder $scope, string $slug ) : Builder Query scope for finding a model by its primary slug.

Method Details

findBySlug() public static method

Find a model by its primary slug.
public static findBySlug ( string $slug, array $columns = ['*'] ) : Model | Illuminate\Database\Eloquent\Collection | static[] | static | null
$slug string
$columns array
return Illuminate\Database\Eloquent\Model | Illuminate\Database\Eloquent\Collection | static[] | static | null

findBySlugOrFail() public static method

Find a model by its primary slug or throw an exception.
public static findBySlugOrFail ( string $slug, array $columns = ['*'] ) : Model | Illuminate\Database\Eloquent\Collection
$slug string
$columns array
return Illuminate\Database\Eloquent\Model | Illuminate\Database\Eloquent\Collection

getSlugKey() public method

Primary slug value of this model.
public getSlugKey ( ) : string
return string

getSlugKeyName() public method

Primary slug column of this model.
public getSlugKeyName ( ) : string
return string

scopeWhereSlug() public method

Query scope for finding a model by its primary slug.
public scopeWhereSlug ( Builder $scope, string $slug ) : Builder
$scope Illuminate\Database\Eloquent\Builder
$slug string
return Illuminate\Database\Eloquent\Builder