PHP Class Hootlex\Moderation\ModerationScope

Inheritance: implements Illuminate\Database\Eloquent\Scope
显示文件 Open project: hootlex/laravel-moderation

Protected Properties

Property Type Description
$extensions array All of the extensions to be added to the builder.

Public Methods

Method Description
apply ( Builder $builder, Model $model ) : void Apply the scope to a given Eloquent query builder.
extend ( Builder $builder ) : void Extend the query builder with the needed functions.
remove ( Builder $builder, Model $model ) : void Remove the scope from the given Eloquent query builder.

Protected Methods

Method Description
addApprove ( Builder $builder ) : void Add the Approve extension to the builder.
addPend ( Builder $builder ) : void Add the Postpone extension to the builder.
addPending ( Builder $builder ) : void Add the Pending extension to the builder.
addPostpone ( Builder $builder ) : void Add the Postpone extension to the builder.
addPostponed ( Builder $builder ) : void Add the Postponed extension to the builder.
addReject ( Builder $builder ) : void Add the Reject extension to the builder.
addRejected ( Builder $builder ) : void Add the Rejected extension to the builder.
addWithAnyStatus ( Builder $builder ) : void Add the with-any-status extension to the builder.
addWithPending ( Builder $builder ) : void Add the with-pending extension to the builder.
addWithPostponed ( Builder $builder ) : void Add the with-postpone extension to the builder.
addWithRejected ( Builder $builder ) : void Add the with-rejected extension to the builder.
getStatusColumn ( Builder $builder ) : string Get the "deleted at" column for the builder.
isModerationConstraint ( array $where, string $column ) : boolean Determine if the given where clause is a moderation constraint.
removeBinding ( $query, integer $key ) Remove scope constraint from the query.
removeWhere ( $query, integer $key ) Remove scope constraint from the query.

Private Methods

Method Description
updateModerationStatus ( Builder $builder, $id, $status ) : boolean | integer

Method Details

addApprove() protected method

Add the Approve extension to the builder.
protected addApprove ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addPend() protected method

Add the Postpone extension to the builder.
protected addPend ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addPending() protected method

Add the Pending extension to the builder.
protected addPending ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addPostpone() protected method

Add the Postpone extension to the builder.
protected addPostpone ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addPostponed() protected method

Add the Postponed extension to the builder.
protected addPostponed ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addReject() protected method

Add the Reject extension to the builder.
protected addReject ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addRejected() protected method

Add the Rejected extension to the builder.
protected addRejected ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addWithAnyStatus() protected method

Add the with-any-status extension to the builder.
protected addWithAnyStatus ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addWithPending() protected method

Add the with-pending extension to the builder.
protected addWithPending ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addWithPostponed() protected method

Add the with-postpone extension to the builder.
protected addWithPostponed ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

addWithRejected() protected method

Add the with-rejected extension to the builder.
protected addWithRejected ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

apply() public method

Apply the scope to a given Eloquent query builder.
public apply ( Builder $builder, Model $model ) : void
$builder Illuminate\Database\Eloquent\Builder
$model Illuminate\Database\Eloquent\Model
return void

extend() public method

Extend the query builder with the needed functions.
public extend ( Builder $builder ) : void
$builder Illuminate\Database\Eloquent\Builder
return void

getStatusColumn() protected method

Get the "deleted at" column for the builder.
protected getStatusColumn ( Builder $builder ) : string
$builder Illuminate\Database\Eloquent\Builder
return string

isModerationConstraint() protected method

Determine if the given where clause is a moderation constraint.
protected isModerationConstraint ( array $where, string $column ) : boolean
$where array
$column string
return boolean

remove() public method

(This method exists in order to achieve compatibility with laravel 5.1.*)
public remove ( Builder $builder, Model $model ) : void
$builder Illuminate\Database\Eloquent\Builder
$model Illuminate\Database\Eloquent\Model
return void

removeBinding() protected method

Remove scope constraint from the query.
protected removeBinding ( $query, integer $key )
$query
$key integer

removeWhere() protected method

Remove scope constraint from the query.
protected removeWhere ( $query, integer $key )
$query
$key integer

Property Details

$extensions protected_oe property

All of the extensions to be added to the builder.
protected array $extensions
return array