PHP Class LMongo\Eloquent\Model

Inheritance: implements ArrayAcces\ArrayAccess, implements Illuminate\Support\Contracts\ArrayableInterface, implements Illuminate\Support\Contracts\JsonableInterface
显示文件 Open project: navruzm/lmongo Class Usage Examples

Public Properties

Property Type Description
$exists boolean Indicates if the model exists.
$incrementing boolean Indicates if the IDs are auto-incrementing.
$snakeAttributes boolean Indicates whether attributes are snake cased on arrays.
$timestamps boolean Indicates if the model should be timestamped.

Protected Properties

Property Type Description
$attributes array The model's attributes.
$booted array The array of booted models.
$collection string The collection associated with the model.
$connection string The connection name for the model.
$dispatcher Illuminate\Events\Dispatcher The event dispatcher instance.
$fillable array The attributes that are mass assignable.
$guarded array The attributes that aren't mass assignable.
$hidden array The attributes that should be hidden for arrays.
$mutatorCache array The cache of the mutated attributes for each class.
$original array The model attribute's original state.
$perPage integer The number of models to return for pagination.
$primaryKey string The primary key for the model.
$relations array The loaded relationships for the model.
$resolver LMongo\ConnectionResolverInterface The connection resolver instance.
$softDelete boolean Indicates if the model should soft delete.
$touches array The relationships that should be touched on save.
$unguarded boolean Indicates if all mass assignment is enabled.
$visible arrays The attributes that should be visible in arrays.
$with array The relations to eager load on every query.

Public Methods

Method Description
__call ( string $method, array $parameters ) : mixed Handle dynamic method calls into the method.
__callStatic ( string $method, array $parameters ) : mixed Handle dynamic static method calls into the method.
__construct ( array $attributes = [] ) : void Create a new Eloquent model instance.
__get ( string $key ) : mixed Dynamically retrieve attributes on the model.
__isset ( string $key ) : void Determine if an attribute exists on the model.
__set ( string $key, mixed $value ) : void Dynamically set attributes on the model.
__toString ( ) : string Convert the model to its string representation.
__unset ( string $key ) : void Unset an attribute on the model.
all ( array $columns = [] ) : Collection Get all of the models from the database.
attributesToArray ( ) : array Convert the model's attributes to an array.
belongsTo ( string $related, string $foreignKey = null ) : BelongsTo Define an inverse one-to-one or many relationship.
belongsToMany ( string $related, string $foreignKey = null, string $otherKey = null ) : BelongsToMany Define a many-to-many relationship.
collection ( string $collection ) : void Set the collection associated with the model.
create ( array $attributes ) : Model Save a new model and return the instance.
created ( Closur\Closure | string $callback ) : void Register a created model event with the dispatcher.
creating ( Closur\Closure | string $callback ) : void Register a creating model event with the dispatcher.
delete ( ) : boolean | null Delete the model from the database.
deleted ( Closur\Closure | string $callback ) : void Register a deleted model event with the dispatcher.
deleting ( Closur\Closure | string $callback ) : void Register a deleting model event with the dispatcher.
destroy ( array | integer $ids ) : void Destroy the models for the given IDs.
fill ( array $attributes ) : Model Fill the model with an array of attributes.
fillable ( array $fillable ) : Model Set the fillable attributes for the model.
find ( mixed $id, array $columns = [] ) : Model | Collection Find a model by its primary key.
findOrFail ( mixed $id, array $columns = [] ) : Model | Collection Find a model by its primary key or throw an exception.
flushEventListeners ( ) : void Remove all of the event listeners for the model.
forceDelete ( ) : void Force a hard delete on a soft deleted model.
freshTimestamp ( ) : MongoDate Get a fresh MongoDate for the model.
getAttribute ( string $key ) : mixed Get an attribute from the model.
getAttributes ( ) : array Get all of the current attributes on the model.
getCollection ( ) : string Get the collection associated with the model.
getConnection ( ) : Connection Get the database connection for the model.
getConnectionName ( ) : string Get the current connection name for the model.
getConnectionResolver ( ) : LMongo\ConnectionResolverInterface Get the connection resolver instance.
getCreatedAtColumn ( ) : string Get the name of the "created at" column.
getDates ( ) : array Get the attributes that should be converted to dates.
getDeletedAtColumn ( ) : string Get the name of the "deleted at" column.
getDirty ( ) : array Get the attributes that have been changed since last sync.
getEventDispatcher ( ) : Illuminate\Events\Dispatcher Get the event dispatcher instance.
getFillable ( ) : array Get the fillable attributes for the model.
getForeignKey ( ) : string Get the default foreign key name for the model.
getHidden ( ) : array Get the hidden attributes for the model.
getIncrementing ( ) : boolean Get the value indicating whether the IDs are incrementing.
getKey ( ) : mixed Get the value of the model's primary key.
getKeyName ( ) : string Get the primary key for the model.
getMutatedAttributes ( ) : array Get the mutated attributes for a given instance.
getObservableEvents ( ) : array Get the observable event names.
getOriginal ( string $key = null, mixed $default = null ) : array Get the model's original attribute values.
getPerPage ( ) : integer Get the number of models to return per page.
getQualifiedDeletedAtColumn ( ) : string Get the fully qualified "deleted at" column.
getRelation ( string $relation ) : mixed Get a specified relationship.
getRelations ( ) : array Get all the loaded relations for the instance.
getTouchedRelations ( ) : array Get the relationships that are touched on save.
getUpdatedAtColumn ( ) : string Get the name of the "updated at" column.
guard ( array $guarded ) : Model Set the guarded attributes for the model.
hasGetMutator ( string $key ) : boolean Determine if a get mutator exists for an attribute.
hasMany ( string $related, string $foreignKey = null ) : HasMany Define a one-to-many relationship.
hasOne ( string $related, string $foreignKey = null ) : LMongo\Eloquent\Relation\HasOne Define a one-to-one relationship.
hasSetMutator ( string $key ) : boolean Determine if a set mutator exists for an attribute.
isDirty ( string $attribute ) : boolean Determine if a given attribute is dirty.
isFillable ( string $key ) : boolean Determine if the given attribute may be mass assigned.
isGuarded ( string $key ) : boolean Determine if the given key is guarded.
isSoftDeleting ( ) : boolean Determine if the model instance uses soft deletes.
load ( array | string $relations ) : void Eager load relations on the model.
morphMany ( string $related, string $name, string $type = null, string $id = null ) : LMongo\Eloquent\Relation\MorphMany Define a polymorphic one-to-many relationship.
morphOne ( string $related, string $name, string $type = null, string $id = null ) : LMongo\Eloquent\Relation\MorphOne Define a polymorphic one-to-one relationship.
morphTo ( string $name = null, string $type = null, string $id = null ) : BelongsTo Define an polymorphic, inverse one-to-one or many relationship.
newCollection ( array $models = [] ) : Collection Create a new Collection instance.
newFromBuilder ( array $attributes = [] ) : Model Create a new model instance that is existing.
newInstance ( array $attributes = [], boolean $exists = false ) : Model Create a new instance of the given model.
newQuery ( boolean $excludeDeleted = true ) : Builder Get a new query builder for the model's table.
newQueryWithDeleted ( ) : Builder Get a new query builder that includes soft deletes.
observe ( object $class ) : void Register an observer with the Model.
offsetExists ( mixed $offset ) : boolean Determine if the given attribute exists.
offsetGet ( mixed $offset ) : mixed Get the value for a given offset.
offsetSet ( mixed $offset, mixed $value ) : void Set the value for a given offset.
offsetUnset ( mixed $offset ) : void Unset the value for a given offset.
on ( string $connection = null ) : Builder Begin querying the model on a given connection.
onlyTrashed ( ) : Builder Get a new query builder that only includes soft deletes.
push ( ) : boolean Save the model and all of its relationships.
query ( ) : Builder Begin querying the model.
reguard ( ) : void Enable the mass assignment restrictions.
relationsToArray ( ) : array Get the model's relationships in array form.
replicate ( ) : Model Clone the model into a new, non-existing instance.
resolveConnection ( string $connection = null ) : Connection Resolve a connection instance.
restore ( ) : boolean | null Restore a soft-deleted model instance.
save ( ) : boolean Save the model to the database.
saved ( Closur\Closure | string $callback ) : void Register a saved model event with the dispatcher.
saving ( Closur\Closure | string $callback ) : void Register a saving model event with the dispatcher.
setAttribute ( string $key, mixed $value ) : void Set a given attribute on the model.
setConnection ( string $name ) : void Set the connection associated with the model.
setConnectionResolver ( LMongo\ConnectionResolverInterface $resolver ) : void Set the connection resolver instance.
setCreatedAt ( mixed $value ) : void Set the value of the "created at" attribute.
setEventDispatcher ( Illuminate\Events\Dispatcher $dispatcher ) : void Set the event dispatcher instance.
setHidden ( array $hidden ) : void Set the hidden attributes for the model.
setIncrementing ( boolean $value ) : void Set whether IDs are incrementing.
setPerPage ( integer $perPage ) : void Set the number of models ot return per page.
setRawAttributes ( array $attributes, boolean $sync = false ) : void Set the array of model attributes. No checking is done.
setRelation ( string $relation, mixed $value ) : Model Set the specific relationship in the model.
setRelations ( array $relations ) : Model Set the entire relations array on the model.
setSoftDeleting ( boolean $enabled ) : void Set the soft deleting property on the model.
setTouchedRelations ( array $touches ) : void Set the relationships that are touched on save.
setUnguardState ( boolean $state ) : void Set "unguard" to a given state.
setUpdatedAt ( mixed $value ) : void Set the value of the "updated at" attribute.
setVisible ( array $visible ) : void Set the visible attributes for the model.
syncOriginal ( ) : Model Sync the original attributes with the current.
toArray ( ) : array Convert the model instance to an array.
toJson ( integer $options ) : string Convert the model instance to JSON.
totallyGuarded ( ) : boolean Determine if the model is totally guarded.
touch ( ) : boolean Update the model's update timestamp.
touchOwners ( ) : void Touch the owning relations of the model.
touches ( string $relation ) : boolean Determine if the model touches a given relation.
trashed ( ) : boolean Determine if the model instance has been soft-deleted.
unguard ( ) : void Disable all mass assignable restrictions.
unsetEventDispatcher ( ) : void Unset the event dispatcher for models.
update ( array $attributes = [] ) : mixed Update the model in the database.
updated ( Closur\Closure | string $callback ) : void Register an updated model event with the dispatcher.
updating ( Closur\Closure | string $callback ) : void Register an updating model event with the dispatcher.
usesTimestamps ( ) : boolean Determine if the model uses timestamps.
with ( array | string $relations ) : Builder Being querying a model with eager loading.
withTrashed ( ) : Builder Get a new query builder that includes soft deletes.

Protected Methods

Method Description
asDateTime ( mixed $value ) : DateTime Return a timestamp as DateTime object.
boot ( ) : void The "booting" method of the model.
decrement ( string $column, integer $amount = 1 ) : integer Decrement a column's value by a given amount.
finishSave ( ) : void Finish processing on a successful save operation.
fireModelEvent ( string $event, boolean $halt = true ) : mixed Fire the given event for the model.
fromDateTime ( DateTim\DateTime | integer $value ) : string Convert a DateTime to a storable string.
getArrayableAttributes ( ) : array Get an attribute array of all arrayable attributes.
getAttributeFromArray ( string $key ) : mixed Get an attribute from the $attributes array.
getAttributeValue ( string $key ) : mixed Get a plain attribute (not a relationship).
getDateFormat ( ) : string Get the format for database stored dates.
getMorphs ( string $name, string $type, string $id ) : array Get the polymorphic relationship columns.
increment ( string $column, integer $amount = 1 ) : integer Increment a column's value by a given amount.
incrementOrDecrement ( string $column, integer $amount, string $method ) : integer Run the increment or decrement method on the model.
insertAndSetId ( Builder $query, array $attributes ) : void Insert the given attributes and set the ID on the model.
mutateAttribute ( string $key, mixed $value ) : mixed Get the value of an attribute using its mutator.
newBaseQueryBuilder ( ) : Builder Get a new query builder instance for the connection.
performDeleteOnModel ( ) : void Perform the actual delete query on this model instance.
performInsert ( $query ) : boolean Perform a model insert operation.
performUpdate ( $query ) : boolean Perform a model update operation.
registerModelEvent ( string $event, Closur\Closure | string $callback ) : void Register a model event with the dispatcher.
setKeysForSaveQuery ( $query ) : Builder Set the keys for a save update query.
updateTimestamps ( ) : void Update the creation and update timestamps.

Method Details

__call() public method

Handle dynamic method calls into the method.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed

__callStatic() public static method

Handle dynamic static method calls into the method.
public static __callStatic ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed

__construct() public method

Create a new Eloquent model instance.
public __construct ( array $attributes = [] ) : void
$attributes array
return void

__get() public method

Dynamically retrieve attributes on the model.
public __get ( string $key ) : mixed
$key string
return mixed

__isset() public method

Determine if an attribute exists on the model.
public __isset ( string $key ) : void
$key string
return void

__set() public method

Dynamically set attributes on the model.
public __set ( string $key, mixed $value ) : void
$key string
$value mixed
return void

__toString() public method

Convert the model to its string representation.
public __toString ( ) : string
return string

__unset() public method

Unset an attribute on the model.
public __unset ( string $key ) : void
$key string
return void

all() public static method

Get all of the models from the database.
public static all ( array $columns = [] ) : Collection
$columns array
return Collection

asDateTime() protected method

Return a timestamp as DateTime object.
protected asDateTime ( mixed $value ) : DateTime
$value mixed
return DateTime

attributesToArray() public method

Convert the model's attributes to an array.
public attributesToArray ( ) : array
return array

belongsTo() public method

Define an inverse one-to-one or many relationship.
public belongsTo ( string $related, string $foreignKey = null ) : BelongsTo
$related string
$foreignKey string
return LMongo\Eloquent\Relations\BelongsTo

belongsToMany() public method

Define a many-to-many relationship.
public belongsToMany ( string $related, string $foreignKey = null, string $otherKey = null ) : BelongsToMany
$related string
$foreignKey string
$otherKey string
return LMongo\Eloquent\Relations\BelongsToMany

boot() protected static method

The "booting" method of the model.
protected static boot ( ) : void
return void

collection() public method

Set the collection associated with the model.
public collection ( string $collection ) : void
$collection string
return void

create() public static method

Save a new model and return the instance.
public static create ( array $attributes ) : Model
$attributes array
return Model

created() public static method

Register a created model event with the dispatcher.
public static created ( Closur\Closure | string $callback ) : void
$callback Closur\Closure | string
return void

creating() public static method

Register a creating model event with the dispatcher.
public static creating ( Closur\Closure | string $callback ) : void
$callback Closur\Closure | string
return void

decrement() protected method

Decrement a column's value by a given amount.
protected decrement ( string $column, integer $amount = 1 ) : integer
$column string
$amount integer
return integer

delete() public method

Delete the model from the database.
public delete ( ) : boolean | null
return boolean | null

deleted() public static method

Register a deleted model event with the dispatcher.
public static deleted ( Closur\Closure | string $callback ) : void
$callback Closur\Closure | string
return void

deleting() public static method

Register a deleting model event with the dispatcher.
public static deleting ( Closur\Closure | string $callback ) : void
$callback Closur\Closure | string
return void

destroy() public static method

Destroy the models for the given IDs.
public static destroy ( array | integer $ids ) : void
$ids array | integer
return void

fill() public method

Fill the model with an array of attributes.
public fill ( array $attributes ) : Model
$attributes array
return Model

fillable() public method

Set the fillable attributes for the model.
public fillable ( array $fillable ) : Model
$fillable array
return Model

find() public static method

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

findOrFail() public static method

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

finishSave() protected method

Finish processing on a successful save operation.
protected finishSave ( ) : void
return void

fireModelEvent() protected method

Fire the given event for the model.
protected fireModelEvent ( string $event, boolean $halt = true ) : mixed
$event string
$halt boolean
return mixed

flushEventListeners() public static method

Remove all of the event listeners for the model.
public static flushEventListeners ( ) : void
return void

forceDelete() public method

Force a hard delete on a soft deleted model.
public forceDelete ( ) : void
return void

freshTimestamp() public method

Get a fresh MongoDate for the model.
public freshTimestamp ( ) : MongoDate
return MongoDate

fromDateTime() protected method

Convert a DateTime to a storable string.
protected fromDateTime ( DateTim\DateTime | integer $value ) : string
$value DateTim\DateTime | integer
return string

getArrayableAttributes() protected method

Get an attribute array of all arrayable attributes.
protected getArrayableAttributes ( ) : array
return array

getAttribute() public method

Get an attribute from the model.
public getAttribute ( string $key ) : mixed
$key string
return mixed

getAttributeFromArray() protected method

Get an attribute from the $attributes array.
protected getAttributeFromArray ( string $key ) : mixed
$key string
return mixed

getAttributeValue() protected method

Get a plain attribute (not a relationship).
protected getAttributeValue ( string $key ) : mixed
$key string
return mixed

getAttributes() public method

Get all of the current attributes on the model.
public getAttributes ( ) : array
return array

getCollection() public method

Get the collection associated with the model.
public getCollection ( ) : string
return string

getConnection() public method

Get the database connection for the model.
public getConnection ( ) : Connection
return LMongo\Connection

getConnectionName() public method

Get the current connection name for the model.
public getConnectionName ( ) : string
return string

getConnectionResolver() public static method

Get the connection resolver instance.
public static getConnectionResolver ( ) : LMongo\ConnectionResolverInterface
return LMongo\ConnectionResolverInterface

getCreatedAtColumn() public method

Get the name of the "created at" column.
public getCreatedAtColumn ( ) : string
return string

getDateFormat() protected method

Get the format for database stored dates.
protected getDateFormat ( ) : string
return string

getDates() public method

Get the attributes that should be converted to dates.
public getDates ( ) : array
return array

getDeletedAtColumn() public method

Get the name of the "deleted at" column.
public getDeletedAtColumn ( ) : string
return string

getDirty() public method

Get the attributes that have been changed since last sync.
public getDirty ( ) : array
return array

getEventDispatcher() public static method

Get the event dispatcher instance.
public static getEventDispatcher ( ) : Illuminate\Events\Dispatcher
return Illuminate\Events\Dispatcher

getFillable() public method

Get the fillable attributes for the model.
public getFillable ( ) : array
return array

getForeignKey() public method

Get the default foreign key name for the model.
public getForeignKey ( ) : string
return string

getHidden() public method

Get the hidden attributes for the model.
public getHidden ( ) : array
return array

getIncrementing() public method

Get the value indicating whether the IDs are incrementing.
public getIncrementing ( ) : boolean
return boolean

getKey() public method

Get the value of the model's primary key.
public getKey ( ) : mixed
return mixed

getKeyName() public method

Get the primary key for the model.
public getKeyName ( ) : string
return string

getMorphs() protected method

Get the polymorphic relationship columns.
protected getMorphs ( string $name, string $type, string $id ) : array
$name string
$type string
$id string
return array

getMutatedAttributes() public method

Get the mutated attributes for a given instance.
public getMutatedAttributes ( ) : array
return array

getObservableEvents() public method

Get the observable event names.
public getObservableEvents ( ) : array
return array

getOriginal() public method

Get the model's original attribute values.
public getOriginal ( string $key = null, mixed $default = null ) : array
$key string
$default mixed
return array

getPerPage() public method

Get the number of models to return per page.
public getPerPage ( ) : integer
return integer

getQualifiedDeletedAtColumn() public method

Get the fully qualified "deleted at" column.

getRelation() public method

Get a specified relationship.
public getRelation ( string $relation ) : mixed
$relation string
return mixed

getRelations() public method

Get all the loaded relations for the instance.
public getRelations ( ) : array
return array

getTouchedRelations() public method

Get the relationships that are touched on save.
public getTouchedRelations ( ) : array
return array

getUpdatedAtColumn() public method

Get the name of the "updated at" column.
public getUpdatedAtColumn ( ) : string
return string

guard() public method

Set the guarded attributes for the model.
public guard ( array $guarded ) : Model
$guarded array
return Model

hasGetMutator() public method

Determine if a get mutator exists for an attribute.
public hasGetMutator ( string $key ) : boolean
$key string
return boolean

hasMany() public method

Define a one-to-many relationship.
public hasMany ( string $related, string $foreignKey = null ) : HasMany
$related string
$foreignKey string
return LMongo\Eloquent\Relations\HasMany

hasOne() public method

Define a one-to-one relationship.
public hasOne ( string $related, string $foreignKey = null ) : LMongo\Eloquent\Relation\HasOne
$related string
$foreignKey string
return LMongo\Eloquent\Relation\HasOne

hasSetMutator() public method

Determine if a set mutator exists for an attribute.
public hasSetMutator ( string $key ) : boolean
$key string
return boolean

increment() protected method

Increment a column's value by a given amount.
protected increment ( string $column, integer $amount = 1 ) : integer
$column string
$amount integer
return integer

incrementOrDecrement() protected method

Run the increment or decrement method on the model.
protected incrementOrDecrement ( string $column, integer $amount, string $method ) : integer
$column string
$amount integer
$method string
return integer

insertAndSetId() protected method

Insert the given attributes and set the ID on the model.
protected insertAndSetId ( Builder $query, array $attributes ) : void
$query Builder
$attributes array
return void

isDirty() public method

Determine if a given attribute is dirty.
public isDirty ( string $attribute ) : boolean
$attribute string
return boolean

isFillable() public method

Determine if the given attribute may be mass assigned.
public isFillable ( string $key ) : boolean
$key string
return boolean

isGuarded() public method

Determine if the given key is guarded.
public isGuarded ( string $key ) : boolean
$key string
return boolean

isSoftDeleting() public method

Determine if the model instance uses soft deletes.
public isSoftDeleting ( ) : boolean
return boolean

load() public method

Eager load relations on the model.
public load ( array | string $relations ) : void
$relations array | string
return void

morphMany() public method

Define a polymorphic one-to-many relationship.
public morphMany ( string $related, string $name, string $type = null, string $id = null ) : LMongo\Eloquent\Relation\MorphMany
$related string
$name string
$type string
$id string
return LMongo\Eloquent\Relation\MorphMany

morphOne() public method

Define a polymorphic one-to-one relationship.
public morphOne ( string $related, string $name, string $type = null, string $id = null ) : LMongo\Eloquent\Relation\MorphOne
$related string
$name string
$type string
$id string
return LMongo\Eloquent\Relation\MorphOne

morphTo() public method

Define an polymorphic, inverse one-to-one or many relationship.
public morphTo ( string $name = null, string $type = null, string $id = null ) : BelongsTo
$name string
$type string
$id string
return LMongo\Eloquent\Relations\BelongsTo

mutateAttribute() protected method

Get the value of an attribute using its mutator.
protected mutateAttribute ( string $key, mixed $value ) : mixed
$key string
$value mixed
return mixed

newBaseQueryBuilder() protected method

Get a new query builder instance for the connection.
protected newBaseQueryBuilder ( ) : Builder
return LMongo\Query\Builder

newCollection() public method

Create a new Collection instance.
public newCollection ( array $models = [] ) : Collection
$models array
return Collection

newFromBuilder() public method

Create a new model instance that is existing.
public newFromBuilder ( array $attributes = [] ) : Model
$attributes array
return Model

newInstance() public method

Create a new instance of the given model.
public newInstance ( array $attributes = [], boolean $exists = false ) : Model
$attributes array
$exists boolean
return Model

newQuery() public method

Get a new query builder for the model's table.
public newQuery ( boolean $excludeDeleted = true ) : Builder
$excludeDeleted boolean
return Builder

newQueryWithDeleted() public method

Get a new query builder that includes soft deletes.
public newQueryWithDeleted ( ) : Builder
return Illuminate\Database\Eloquent\Builder

observe() public static method

Register an observer with the Model.
public static observe ( object $class ) : void
$class object
return void

offsetExists() public method

Determine if the given attribute exists.
public offsetExists ( mixed $offset ) : boolean
$offset mixed
return boolean

offsetGet() public method

Get the value for a given offset.
public offsetGet ( mixed $offset ) : mixed
$offset mixed
return mixed

offsetSet() public method

Set the value for a given offset.
public offsetSet ( mixed $offset, mixed $value ) : void
$offset mixed
$value mixed
return void

offsetUnset() public method

Unset the value for a given offset.
public offsetUnset ( mixed $offset ) : void
$offset mixed
return void

on() public static method

Begin querying the model on a given connection.
public static on ( string $connection = null ) : Builder
$connection string
return Builder

onlyTrashed() public static method

Get a new query builder that only includes soft deletes.
public static onlyTrashed ( ) : Builder
return Illuminate\Database\Eloquent\Builder

performDeleteOnModel() protected method

Perform the actual delete query on this model instance.
protected performDeleteOnModel ( ) : void
return void

performInsert() protected method

Perform a model insert operation.
protected performInsert ( $query ) : boolean
return boolean

performUpdate() protected method

Perform a model update operation.
protected performUpdate ( $query ) : boolean
return boolean

push() public method

Save the model and all of its relationships.
public push ( ) : boolean
return boolean

query() public static method

Begin querying the model.
public static query ( ) : Builder
return Illuminate\Database\Eloquent\Builder

registerModelEvent() protected static method

Register a model event with the dispatcher.
protected static registerModelEvent ( string $event, Closur\Closure | string $callback ) : void
$event string
$callback Closur\Closure | string
return void

reguard() public static method

Enable the mass assignment restrictions.
public static reguard ( ) : void
return void

relationsToArray() public method

Get the model's relationships in array form.
public relationsToArray ( ) : array
return array

replicate() public method

Clone the model into a new, non-existing instance.
public replicate ( ) : Model
return Model

resolveConnection() public static method

Resolve a connection instance.
public static resolveConnection ( string $connection = null ) : Connection
$connection string
return LMongo\Connection

restore() public method

Restore a soft-deleted model instance.
public restore ( ) : boolean | null
return boolean | null

save() public method

Save the model to the database.
public save ( ) : boolean
return boolean

saved() public static method

Register a saved model event with the dispatcher.
public static saved ( Closur\Closure | string $callback ) : void
$callback Closur\Closure | string
return void

saving() public static method

Register a saving model event with the dispatcher.
public static saving ( Closur\Closure | string $callback ) : void
$callback Closur\Closure | string
return void

setAttribute() public method

Set a given attribute on the model.
public setAttribute ( string $key, mixed $value ) : void
$key string
$value mixed
return void

setConnection() public method

Set the connection associated with the model.
public setConnection ( string $name ) : void
$name string
return void

setConnectionResolver() public static method

Set the connection resolver instance.
public static setConnectionResolver ( LMongo\ConnectionResolverInterface $resolver ) : void
$resolver LMongo\ConnectionResolverInterface
return void

setCreatedAt() public method

Set the value of the "created at" attribute.
public setCreatedAt ( mixed $value ) : void
$value mixed
return void

setEventDispatcher() public static method

Set the event dispatcher instance.
public static setEventDispatcher ( Illuminate\Events\Dispatcher $dispatcher ) : void
$dispatcher Illuminate\Events\Dispatcher
return void

setHidden() public method

Set the hidden attributes for the model.
public setHidden ( array $hidden ) : void
$hidden array
return void

setIncrementing() public method

Set whether IDs are incrementing.
public setIncrementing ( boolean $value ) : void
$value boolean
return void

setKeysForSaveQuery() protected method

Set the keys for a save update query.
protected setKeysForSaveQuery ( $query ) : Builder
return Builder

setPerPage() public method

Set the number of models ot return per page.
public setPerPage ( integer $perPage ) : void
$perPage integer
return void

setRawAttributes() public method

Set the array of model attributes. No checking is done.
public setRawAttributes ( array $attributes, boolean $sync = false ) : void
$attributes array
$sync boolean
return void

setRelation() public method

Set the specific relationship in the model.
public setRelation ( string $relation, mixed $value ) : Model
$relation string
$value mixed
return Model

setRelations() public method

Set the entire relations array on the model.
public setRelations ( array $relations ) : Model
$relations array
return Model

setSoftDeleting() public method

Set the soft deleting property on the model.
public setSoftDeleting ( boolean $enabled ) : void
$enabled boolean
return void

setTouchedRelations() public method

Set the relationships that are touched on save.
public setTouchedRelations ( array $touches ) : void
$touches array
return void

setUnguardState() public static method

Set "unguard" to a given state.
public static setUnguardState ( boolean $state ) : void
$state boolean
return void

setUpdatedAt() public method

Set the value of the "updated at" attribute.
public setUpdatedAt ( mixed $value ) : void
$value mixed
return void

setVisible() public method

Set the visible attributes for the model.
public setVisible ( array $visible ) : void
$visible array
return void

syncOriginal() public method

Sync the original attributes with the current.
public syncOriginal ( ) : Model
return Model

toArray() public method

Convert the model instance to an array.
public toArray ( ) : array
return array

toJson() public method

Convert the model instance to JSON.
public toJson ( integer $options ) : string
$options integer
return string

totallyGuarded() public method

Determine if the model is totally guarded.
public totallyGuarded ( ) : boolean
return boolean

touch() public method

Update the model's update timestamp.
public touch ( ) : boolean
return boolean

touchOwners() public method

Touch the owning relations of the model.
public touchOwners ( ) : void
return void

touches() public method

Determine if the model touches a given relation.
public touches ( string $relation ) : boolean
$relation string
return boolean

trashed() public method

Determine if the model instance has been soft-deleted.
public trashed ( ) : boolean
return boolean

unguard() public static method

Disable all mass assignable restrictions.
public static unguard ( ) : void
return void

unsetEventDispatcher() public static method

Unset the event dispatcher for models.
public static unsetEventDispatcher ( ) : void
return void

update() public method

Update the model in the database.
public update ( array $attributes = [] ) : mixed
$attributes array
return mixed

updateTimestamps() protected method

Update the creation and update timestamps.
protected updateTimestamps ( ) : void
return void

updated() public static method

Register an updated model event with the dispatcher.
public static updated ( Closur\Closure | string $callback ) : void
$callback Closur\Closure | string
return void

updating() public static method

Register an updating model event with the dispatcher.
public static updating ( Closur\Closure | string $callback ) : void
$callback Closur\Closure | string
return void

usesTimestamps() public method

Determine if the model uses timestamps.
public usesTimestamps ( ) : boolean
return boolean

with() public static method

Being querying a model with eager loading.
public static with ( array | string $relations ) : Builder
$relations array | string
return Builder

withTrashed() public static method

Get a new query builder that includes soft deletes.
public static withTrashed ( ) : Builder
return Illuminate\Database\Eloquent\Builder

Property Details

$attributes protected_oe property

The model's attributes.
protected array $attributes
return array

$booted protected_oe static_oe property

The array of booted models.
protected static array $booted
return array

$collection protected_oe property

The collection associated with the model.
protected string $collection
return string

$connection protected_oe property

The connection name for the model.
protected string $connection
return string

$dispatcher protected_oe static_oe property

The event dispatcher instance.
protected static Dispatcher,Illuminate\Events $dispatcher
return Illuminate\Events\Dispatcher

$exists public_oe property

Indicates if the model exists.
public bool $exists
return boolean

$fillable protected_oe property

The attributes that are mass assignable.
protected array $fillable
return array

$guarded protected_oe property

The attributes that aren't mass assignable.
protected array $guarded
return array

$hidden protected_oe property

The attributes that should be hidden for arrays.
protected array $hidden
return array

$incrementing public_oe property

Indicates if the IDs are auto-incrementing.
public bool $incrementing
return boolean

$mutatorCache protected_oe static_oe property

The cache of the mutated attributes for each class.
protected static array $mutatorCache
return array

$original protected_oe property

The model attribute's original state.
protected array $original
return array

$perPage protected_oe property

The number of models to return for pagination.
protected int $perPage
return integer

$primaryKey protected_oe property

The primary key for the model.
protected string $primaryKey
return string

$relations protected_oe property

The loaded relationships for the model.
protected array $relations
return array

$resolver protected_oe static_oe property

The connection resolver instance.
protected static ConnectionResolverInterface,LMongo $resolver
return LMongo\ConnectionResolverInterface

$snakeAttributes public_oe static_oe property

Indicates whether attributes are snake cased on arrays.
public static bool $snakeAttributes
return boolean

$softDelete protected_oe property

Indicates if the model should soft delete.
protected bool $softDelete
return boolean

$timestamps public_oe property

Indicates if the model should be timestamped.
public bool $timestamps
return boolean

$touches protected_oe property

The relationships that should be touched on save.
protected array $touches
return array

$unguarded protected_oe static_oe property

Indicates if all mass assignment is enabled.
protected static bool $unguarded
return boolean

$visible protected_oe property

The attributes that should be visible in arrays.
protected arrays $visible
return arrays

$with protected_oe property

The relations to eager load on every query.
protected array $with
return array