PHP Class LMongo\Eloquent\Builder

Datei anzeigen Open project: navruzm/lmongo Class Usage Examples

Protected Properties

Property Type Description
$eagerLoad array The relationships that should be eager loaded.
$model Model The model being queried.
$passthru array The methods that should be returned from query builder.
$query Builder The base query builder instance.
$total array Total count for paginate method.

Public Methods

Method Description
__call ( string $method, array $parameters ) : mixed Dynamically handle calls into the query instance.
__construct ( Builder $query ) : void Create a new model query builder instance.
decrement ( string $column, integer $amount = 1, array $extra = [] ) : integer Decrement a column's value by a given amount.
delete ( ) : integer Delete a record from the database.
eagerLoadRelations ( array $models ) : array Eager load the relationships for the models.
find ( mixed $id, array $columns = [] ) : Model | null Find a model by its primary key.
findOrFail ( mixed $id, array $columns = [] ) : Model Find a model by its primary key or throw an exception.
first ( array $columns = [] ) : Model | null Execute the query and get the first result.
firstOrFail ( array $columns = [] ) : Model Execute the query and get the first result or throw an exception.
forceDelete ( ) : integer Force a delete on a set of soft deleted models.
get ( array $columns = [] ) : Collection Execute the query as a "select" statement.
getEagerLoads ( ) : array Get the relationships being eagerly loaded.
getModel ( ) : Model Get the model instance being queried.
getModels ( array $columns = [] ) : array Get the hydrated models without eager loading.
getQuery ( ) : Builder Get the underlying query builder instance.
getRelation ( string $relation ) : Relation Get the relation instance for the given relation name.
increment ( string $column, integer $amount = 1, array $extra = [] ) : integer Increment a column's value by a given amount.
onlyTrashed ( ) : Builder Force the result set to only included soft deletes.
paginate ( integer $perPage = null, array $columns = [] ) : Illuminate\Pagination\Paginator Get a paginator for the "select" statement.
pluck ( string $column ) : mixed Pluck a single column from the database.
restore ( ) : integer Restore the soft-deleted model instances.
setEagerLoads ( array $eagerLoad ) : void Set the relationships being eagerly loaded.
setModel ( Model $model ) : Builder Set a model instance for the model being queried.
setQuery ( Builder $query ) : void Set the underlying query builder instance.
update ( array $values ) : integer Update a record in the database.
with ( $relations ) : Builder Set the relationships that should be eager loaded.
withTrashed ( ) : LMongo\Eloquent\Builder Include the soft deleted models in the results.

Protected Methods

Method Description
addUpdatedAtColumn ( array $values ) : array Add the "updated at" column to an array of values.
isNested ( string $name, string $relation ) : boolean Determine if the relationship is nested.
isSoftDeleteConstraint ( array $where, string $column ) : boolean Determine if the given where clause is a soft delete constraint.
loadRelation ( array $models, $name, Closure $constraints ) : array Eagerly load the relationship on a set of models.
nestedRelations ( string $relation ) : array Get the deeply nested relations for a given top-level relation.
parseNested ( string $name, array $results ) : array Parse the nested relationships in a relation.
parseRelations ( array $relations ) : array Parse a list of relations into individuals.
softDelete ( ) : integer Soft delete the record in the database.

Method Details

__call() public method

Dynamically handle calls into the query instance.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed

__construct() public method

Create a new model query builder instance.
public __construct ( Builder $query ) : void
$query LMongo\Query\Builder
return void

addUpdatedAtColumn() protected method

Add the "updated at" column to an array of values.
protected addUpdatedAtColumn ( array $values ) : array
$values array
return array

decrement() public method

Decrement a column's value by a given amount.
public decrement ( string $column, integer $amount = 1, array $extra = [] ) : integer
$column string
$amount integer
$extra array
return integer

delete() public method

Delete a record from the database.
public delete ( ) : integer
return integer

eagerLoadRelations() public method

Eager load the relationships for the models.
public eagerLoadRelations ( array $models ) : array
$models array
return array

find() public method

Find a model by its primary key.
public find ( mixed $id, array $columns = [] ) : Model | null
$id mixed
$columns array
return Model | null

findOrFail() public method

Find a model by its primary key or throw an exception.
public findOrFail ( mixed $id, array $columns = [] ) : Model
$id mixed
$columns array
return Model

first() public method

Execute the query and get the first result.
public first ( array $columns = [] ) : Model | null
$columns array
return Model | null

firstOrFail() public method

Execute the query and get the first result or throw an exception.
public firstOrFail ( array $columns = [] ) : Model
$columns array
return Model

forceDelete() public method

Force a delete on a set of soft deleted models.
public forceDelete ( ) : integer
return integer

get() public method

Execute the query as a "select" statement.
public get ( array $columns = [] ) : Collection
$columns array
return Collection

getEagerLoads() public method

Get the relationships being eagerly loaded.
public getEagerLoads ( ) : array
return array

getModel() public method

Get the model instance being queried.
public getModel ( ) : Model
return Model

getModels() public method

Get the hydrated models without eager loading.
public getModels ( array $columns = [] ) : array
$columns array
return array

getQuery() public method

Get the underlying query builder instance.
public getQuery ( ) : Builder
return LMongo\Query\Builder

getRelation() public method

Get the relation instance for the given relation name.
public getRelation ( string $relation ) : Relation
$relation string
return LMongo\Eloquent\Relations\Relation

increment() public method

Increment a column's value by a given amount.
public increment ( string $column, integer $amount = 1, array $extra = [] ) : integer
$column string
$amount integer
$extra array
return integer

isNested() protected method

Determine if the relationship is nested.
protected isNested ( string $name, string $relation ) : boolean
$name string
$relation string
return boolean

isSoftDeleteConstraint() protected method

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

loadRelation() protected method

Eagerly load the relationship on a set of models.
protected loadRelation ( array $models, $name, Closure $constraints ) : array
$models array
$constraints Closure
return array

nestedRelations() protected method

Get the deeply nested relations for a given top-level relation.
protected nestedRelations ( string $relation ) : array
$relation string
return array

onlyTrashed() public method

Force the result set to only included soft deletes.
public onlyTrashed ( ) : Builder
return Illuminate\Database\Eloquent\Builder

paginate() public method

Get a paginator for the "select" statement.
public paginate ( integer $perPage = null, array $columns = [] ) : Illuminate\Pagination\Paginator
$perPage integer
$columns array
return Illuminate\Pagination\Paginator

parseNested() protected method

Parse the nested relationships in a relation.
protected parseNested ( string $name, array $results ) : array
$name string
$results array
return array

parseRelations() protected method

Parse a list of relations into individuals.
protected parseRelations ( array $relations ) : array
$relations array
return array

pluck() public method

Pluck a single column from the database.
public pluck ( string $column ) : mixed
$column string
return mixed

restore() public method

Restore the soft-deleted model instances.
public restore ( ) : integer
return integer

setEagerLoads() public method

Set the relationships being eagerly loaded.
public setEagerLoads ( array $eagerLoad ) : void
$eagerLoad array
return void

setModel() public method

Set a model instance for the model being queried.
public setModel ( Model $model ) : Builder
$model Model
return Builder

setQuery() public method

Set the underlying query builder instance.
public setQuery ( Builder $query ) : void
$query LMongo\Query\Builder
return void

softDelete() protected method

Soft delete the record in the database.
protected softDelete ( ) : integer
return integer

update() public method

Update a record in the database.
public update ( array $values ) : integer
$values array
return integer

with() public method

Set the relationships that should be eager loaded.
public with ( $relations ) : Builder
return Builder

withTrashed() public method

Include the soft deleted models in the results.
public withTrashed ( ) : LMongo\Eloquent\Builder
return LMongo\Eloquent\Builder

Property Details

$eagerLoad protected_oe property

The relationships that should be eager loaded.
protected array $eagerLoad
return array

$model protected_oe property

The model being queried.
protected Model,LMongo\Eloquent $model
return Model

$passthru protected_oe property

The methods that should be returned from query builder.
protected array $passthru
return array

$query protected_oe property

The base query builder instance.
protected Builder,LMongo\Eloquent $query
return Builder

$total protected_oe property

Total count for paginate method.
protected array $total
return array