class MorphPivot extends Pivot (View source)

Constants

CREATED_AT

The name of the "created at" column.

UPDATED_AT

The name of the "updated at" column.

Properties

bool $incrementing Indicates if the IDs are auto-incrementing. from Model
bool $timestamps Indicates if the model should be timestamped. from Model
bool $exists Indicates if the model exists. from Model
bool $wasRecentlyCreated Indicates if the model was inserted during the current request lifecycle. from Model
static bool $snakeAttributes Indicates whether attributes are snake cased on arrays. from Model
static array $manyMethods The many to many relationship methods. from Model

Methods

void
__construct( Model $parent, array $attributes, string $table, bool $exists = false)

Create a new pivot model instance.

from Pivot
static  void
clearBootedModels()

Clear the list of booted models so they will be re-booted.

from Model
static  void
addGlobalScope( ScopeInterface $scope)

Register a new global scope on the model.

from Model
static  bool
hasGlobalScope( ScopeInterface $scope)

Determine if a model has a global scope.

from Model
static  ScopeInterface|null
getGlobalScope( ScopeInterface $scope)

Get a global scope registered with the model.

from Model
array
getGlobalScopes()

Get the global scopes for this class instance.

from Model
static  void
observe( object|string $class, int $priority)

Register an observer with the Model.

from Model
$this
fill( array $attributes)

Fill the model with an array of attributes.

from Model
$this
forceFill( array $attributes)

Fill the model with an array of attributes. Force mass assignment.

from Model
newInstance( array $attributes = array(), bool $exists = false)

Create a new instance of the given model.

from Model
newFromBuilder( array $attributes = array(), string|null $connection = null)

Create a new model instance that is existing.

from Model
static  Collection
hydrate( array $items, string|null $connection = null)

Create a collection of models from plain arrays.

from Model
static  Collection
hydrateRaw( string $query, array $bindings = array(), string|null $connection = null)

Create a collection of models from a raw query.

from Model
static  Model
create( array $attributes = array())

Save a new model and return the instance.

from Model
static  Model
forceCreate( array $attributes)

Save a new model and return the instance. Allow mass-assignment.

from Model
static  Builder
query()

Begin querying the model.

from Model
static  Builder
on( string|null $connection = null)

Begin querying the model on a given connection.

from Model
static  Builder
onWriteConnection()

Begin querying the model on the write connection.

from Model
static  Collection|Model[]
all( array|mixed $columns = array('*'))

Get all of the models from the database.

from Model
$this|null
fresh( array $with = array())

Reload a fresh model instance from the database.

from Model
$this
load( array|string $relations)

Eager load relations on the model.

from Model
static  Builder|Model
with( array|string $relations)

Begin querying a model with eager loading.

from Model
$this
append( array|string $attributes)

Append attributes to query when building a query.

from Model
hasOne( string $related, string $foreignKey = null, string $localKey = null)

Define a one-to-one relationship.

from Model
morphOne( string $related, string $name, string $type = null, string $id = null, string $localKey = null)

Define a polymorphic one-to-one relationship.

from Model
belongsTo( string $related, string $foreignKey = null, string $otherKey = null, string $relation = null)

Define an inverse one-to-one or many relationship.

from Model
morphTo( string $name = null, string $type = null, string $id = null)

Define a polymorphic, inverse one-to-one or many relationship.

from Model
string
getActualClassNameForMorph( string $class)

Retrieve the fully qualified class name from a slug.

from Model
hasMany( string $related, string $foreignKey = null, string $localKey = null)

Define a one-to-many relationship.

from Model
hasManyThrough( string $related, string $through, string|null $firstKey = null, string|null $secondKey = null, string|null $localKey = null)

Define a has-many-through relationship.

from Model
morphMany( string $related, string $name, string $type = null, string $id = null, string $localKey = null)

Define a polymorphic one-to-many relationship.

from Model
belongsToMany( string $related, string $table = null, string $foreignKey = null, string $otherKey = null, string $relation = null)

Define a many-to-many relationship.

from Model
morphToMany( string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null, bool $inverse = false)

Define a polymorphic many-to-many relationship.

from Model
morphedByMany( string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null)

Define a polymorphic, inverse many-to-many relationship.

from Model
string
joiningTable( string $related)

Get the joining table name for a many-to-many relation.

from Model
static  int
destroy( array|int $ids)

Destroy the models for the given IDs.

from Model
bool|null
delete()

Delete the pivot model record from the database.

bool|null
forceDelete()

Force a hard delete on a soft deleted model.

from Model
static  void
saving( Closure|string $callback, int $priority)

Register a saving model event with the dispatcher.

from Model
static  void
saved( Closure|string $callback, int $priority)

Register a saved model event with the dispatcher.

from Model
static  void
updating( Closure|string $callback, int $priority)

Register an updating model event with the dispatcher.

from Model
static  void
updated( Closure|string $callback, int $priority)

Register an updated model event with the dispatcher.

from Model
static  void
creating( Closure|string $callback, int $priority)

Register a creating model event with the dispatcher.

from Model
static  void
created( Closure|string $callback, int $priority)

Register a created model event with the dispatcher.

from Model
static  void
deleting( Closure|string $callback, int $priority)

Register a deleting model event with the dispatcher.

from Model
static  void
deleted( Closure|string $callback, int $priority)

Register a deleted model event with the dispatcher.

from Model
static  void
flushEventListeners()

Remove all of the event listeners for the model.

from Model
array
getObservableEvents()

Get the observable event names.

from Model
$this
setObservableEvents( array $observables)

Set the observable event names.

from Model
void
addObservableEvents( array|mixed $observables)

Add an observable event name.

from Model
void
removeObservableEvents( array|mixed $observables)

Remove an observable event name.

from Model
bool|int
update( array $attributes = array())

Update the model in the database.

from Model
bool
push()

Save the model and all of its relationships.

from Model
bool
save( array $options = array())

Save the model to the database.

from Model
bool
saveOrFail( array $options = array())

Save the model to the database using transaction.

from Model
void
touchOwners()

Touch the owning relations of the model.

from Model
bool
touches( string $relation)

Determine if the model touches a given relation.

from Model
bool
touch()

Update the model's update timestamp.

from Model
$this
setCreatedAt( mixed $value)

Set the value of the "created at" attribute.

from Model
$this
setUpdatedAt( mixed $value)

Set the value of the "updated at" attribute.

from Model
string
getCreatedAtColumn()

Get the name of the "created at" column.

from Pivot
string
getUpdatedAtColumn()

Get the name of the "updated at" column.

from Pivot
Carbon
freshTimestamp()

Get a fresh timestamp for the model.

from Model
string
freshTimestampString()

Get a fresh timestamp for the model.

from Model
newQuery()

Get a new query builder for the model's table.

from Model
newQueryWithoutScope( ScopeInterface $scope)

Get a new query instance without a given scope.

from Model
newQueryWithoutScopes()

Get a new query builder that doesn't have any global scopes.

from Model
applyGlobalScopes( Builder $builder)

Apply all of the global scopes to an Eloquent builder.

from Model
removeGlobalScopes( Builder $builder)

Remove all of the global scopes from an Eloquent builder.

from Model
newEloquentBuilder( Builder $query)

Create a new Eloquent query builder for the model.

from Model
newCollection( array $models = array())

Create a new Eloquent Collection instance.

from Model
newPivot( Model $parent, array $attributes, string $table, bool $exists)

Create a new pivot model instance.

from Model
string
getTable()

Get the table associated with the model.

from Model
$this
setTable( string $table)

Set the table associated with the model.

from Model
mixed
getKey()

Get the value of the model's primary key.

from Model
mixed
getQueueableId()

Get the queueable identity for the entity.

from Model
string
getKeyName()

Get the primary key for the model.

from Model
$this
setKeyName( string $key)

Set the primary key for the model.

from Model
string
getQualifiedKeyName()

Get the table qualified key name.

from Model
mixed
getRouteKey()

Get the value of the model's route key.

from Model
string
getRouteKeyName()

Get the route key for the model.

from Model
bool
usesTimestamps()

Determine if the model uses timestamps.

from Model
string
getMorphClass()

Get the class name for polymorphic relations.

from Model
int
getPerPage()

Get the number of models to return per page.

from Model
$this
setPerPage( int $perPage)

Set the number of models to return per page.

from Model
string
getForeignKey()

Get the foreign key column name.

from Pivot
array
getHidden()

Get the hidden attributes for the model.

from Model
$this
setHidden( array $hidden)

Set the hidden attributes for the model.

from Model
void
addHidden( array|string|null $attributes = null)

Add hidden attributes for the model.

from Model
$this
withHidden( array|string $attributes)

Make the given, typically hidden, attributes visible.

from Model
array
getVisible()

Get the visible attributes for the model.

from Model
$this
setVisible( array $visible)

Set the visible attributes for the model.

from Model
void
addVisible( array|string|null $attributes = null)

Add visible attributes for the model.

from Model
$this
setAppends( array $appends)

Set the accessors to append to model arrays.

from Model
array
getFillable()

Get the fillable attributes for the model.

from Model
$this
fillable( array $fillable)

Set the fillable attributes for the model.

from Model
array
getGuarded()

Get the guarded attributes for the model.

from Model
$this
guard( array $guarded)

Set the guarded attributes for the model.

from Model
static  void
unguard( bool $state = true)

Disable all mass assignable restrictions.

from Model
static  void
reguard()

Enable the mass assignment restrictions.

from Model
static  bool
isUnguarded()

Determine if current state is "unguarded".

from Model
static  mixed
unguarded( callable $callback)

Run the given callable while being unguarded.

from Model
bool
isFillable( string $key)

Determine if the given attribute may be mass assigned.

from Model
bool
isGuarded( string $key)

Determine if the given key is guarded.

from Model
bool
totallyGuarded()

Determine if the model is totally guarded.

from Model
array
getTouchedRelations()

Get the relationships that are touched on save.

from Model
$this
setTouchedRelations( array $touches)

Set the relationships that are touched on save.

from Model
bool
getIncrementing()

Get the value indicating whether the IDs are incrementing.

from Model
$this
setIncrementing( bool $value)

Set whether IDs are incrementing.

from Model
string
toJson( int $options)

Convert the model instance to JSON.

from Model
array
jsonSerialize()

Convert the object into something JSON serializable.

from Model
array
toArray()

Convert the model instance to an array.

from Model
array
attributesToArray()

Convert the model's attributes to an array.

from Model
array
relationsToArray()

Get the model's relationships in array form.

from Model
mixed
getAttribute( string $key)

Get an attribute from the model.

from Model
mixed
getAttributeValue( string $key)

Get a plain attribute (not a relationship).

from Model
mixed
getRelationValue( string $key)

Get a relationship.

from Model
bool
hasGetMutator( string $key)

Determine if a get mutator exists for an attribute.

from Model
$this
setAttribute( string $key, mixed $value)

Set a given attribute on the model.

from Model
bool
hasSetMutator( string $key)

Determine if a set mutator exists for an attribute.

from Model
array
getDates()

Get the attributes that should be converted to dates.

from Model
string
fromDateTime( DateTime|int $value)

Convert a DateTime to a storable string.

from Model
$this
setDateFormat( string $format)

Set the date format used by the model.

from Model
mixed
fromJson( string $value, bool $asObject = false)

Decode the given JSON back into an array or object.

from Model
replicate( array $except = null)

Clone the model into a new, non-existing instance.

from Model
array
getAttributes()

Get all of the current attributes on the model.

from Model
$this
setRawAttributes( array $attributes, bool $sync = false)

Set the array of model attributes. No checking is done.

from Model
array
getOriginal( string|null $key = null, mixed $default = null)

Get the model's original attribute values.

from Model
$this
syncOriginal()

Sync the original attributes with the current.

from Model
$this
syncOriginalAttribute( string $attribute)

Sync a single original attribute with its current value.

from Model
bool
isDirty( array|string|null $attributes = null)

Determine if the model or given attribute(s) have been modified.

from Model
array
getDirty()

Get the attributes that have been changed since last sync.

from Model
array
getRelations()

Get all the loaded relations for the instance.

from Model
mixed
getRelation( string $relation)

Get a specified relationship.

from Model
bool
relationLoaded( string $key)

Determine if the given relation is loaded.

from Model
$this
setRelation( string $relation, mixed $value)

Set the specific relationship in the model.

from Model
$this
setRelations( array $relations)

Set the entire relations array on the model.

from Model
getConnection()

Get the database connection for the model.

from Model
string
getConnectionName()

Get the current connection name for the model.

from Model
$this
setConnection( string $name)

Set the connection associated with the model.

from Model
static  Connection
resolveConnection( string|null $connection = null)

Resolve a connection instance.

from Model
getConnectionResolver()

Get the connection resolver instance.

from Model
static  void
setConnectionResolver( ConnectionResolverInterface $resolver)

Set the connection resolver instance.

from Model
static  void
unsetConnectionResolver()

Unset the connection resolver for models.

from Model
static  Dispatcher
getEventDispatcher()

Get the event dispatcher instance.

from Model
static  void
setEventDispatcher( Dispatcher $dispatcher)

Set the event dispatcher instance.

from Model
static  void
unsetEventDispatcher()

Unset the event dispatcher for models.

from Model
array
getMutatedAttributes()

Get the mutated attributes for a given instance.

from Model
static  void
cacheMutatedAttributes( string $class)

Extract and cache all the mutated attributes of a class.

from Model
mixed
__get( string $key)

Dynamically retrieve attributes on the model.

from Model
void
__set( string $key, mixed $value)

Dynamically set attributes on the model.

from Model
bool
offsetExists( mixed $offset)

Determine if the given attribute exists.

from Model
mixed
offsetGet( mixed $offset)

Get the value for a given offset.

from Model
void
offsetSet( mixed $offset, mixed $value)

Set the value for a given offset.

from Model
void
offsetUnset( mixed $offset)

Unset the value for a given offset.

from Model
bool
__isset( string $key)

Determine if an attribute exists on the model.

from Model
void
__unset( string $key)

Unset an attribute on the model.

from Model
mixed
__call( string $method, array $parameters)

Handle dynamic method calls into the model.

from Model
static  mixed
__callStatic( string $method, array $parameters)

Handle dynamic static method calls into the method.

from Model
string
__toString()

Convert the model to its string representation.

from Model
void
__wakeup()

When a model is being unserialized, check if it needs to be booted.

from Model
string
getOtherKey()

Get the "other key" column name.

from Pivot
$this
setPivotKeys( string $foreignKey, string $otherKey)

Set the key names for the pivot model instance.

from Pivot
bool
hasTimestampAttributes()

Determine if the pivot model has timestamp attributes.

from Pivot
$this
setMorphType( string $morphType)

Set the morph type for the pivot.

setMorphClass( string $morphClass)

Set the morph class for the pivot.

Details

in Pivot at line line 47
void __construct( Model $parent, array $attributes, string $table, bool $exists = false)

Create a new pivot model instance.

Parameters

Model $parent
array $attributes
string $table
bool $exists

Return Value

void

in Model at line line 330
static void clearBootedModels()

Clear the list of booted models so they will be re-booted.

Return Value

void

in Model at line line 341
static void addGlobalScope( ScopeInterface $scope)

Register a new global scope on the model.

Parameters

ScopeInterface $scope

Return Value

void

in Model at line line 352
static bool hasGlobalScope( ScopeInterface $scope)

Determine if a model has a global scope.

Parameters

ScopeInterface $scope

Return Value

bool

in Model at line line 363
static ScopeInterface|null getGlobalScope( ScopeInterface $scope)

Get a global scope registered with the model.

Parameters

ScopeInterface $scope

Return Value

ScopeInterface|null

in Model at line line 375
array getGlobalScopes()

Get the global scopes for this class instance.

Return Value

array

in Model at line line 387
static void observe( object|string $class, int $priority)

Register an observer with the Model.

Parameters

object|string $class
int $priority

Return Value

void

in Model at line line 411
$this fill( array $attributes)

Fill the model with an array of attributes.

Parameters

array $attributes

Return Value

$this

Exceptions

MassAssignmentException

in Model at line line 437
$this forceFill( array $attributes)

Fill the model with an array of attributes. Force mass assignment.

Parameters

array $attributes

Return Value

$this

in Model at line line 471
Model newInstance( array $attributes = array(), bool $exists = false)

Create a new instance of the given model.

Parameters

array $attributes
bool $exists

Return Value

Model

in Model at line line 490
Model newFromBuilder( array $attributes = array(), string|null $connection = null)

Create a new model instance that is existing.

Parameters

array $attributes
string|null $connection

Return Value

Model

in Model at line line 508
static Collection hydrate( array $items, string|null $connection = null)

Create a collection of models from plain arrays.

Parameters

array $items
string|null $connection

Return Value

Collection

in Model at line line 527
static Collection hydrateRaw( string $query, array $bindings = array(), string|null $connection = null)

Create a collection of models from a raw query.

Parameters

string $query
array $bindings
string|null $connection

Return Value

Collection

in Model at line line 542
static Model create( array $attributes = array())

Save a new model and return the instance.

Parameters

array $attributes

Return Value

Model

in Model at line line 557
static Model forceCreate( array $attributes)

Save a new model and return the instance. Allow mass-assignment.

Parameters

array $attributes

Return Value

Model

in Model at line line 574
static Builder query()

Begin querying the model.

Return Value

Builder

in Model at line line 585
static Builder on( string|null $connection = null)

Begin querying the model on a given connection.

Parameters

string|null $connection

Return Value

Builder

in Model at line line 602
static Builder onWriteConnection()

Begin querying the model on the write connection.

Return Value

Builder

in Model at line line 615
static Collection|Model[] all( array|mixed $columns = array('*'))

Get all of the models from the database.

Parameters

array|mixed $columns

Return Value

Collection|Model[]

in Model at line line 630
$this|null fresh( array $with = array())

Reload a fresh model instance from the database.

Parameters

array $with

Return Value

$this|null

in Model at line line 647
$this load( array|string $relations)

Eager load relations on the model.

Parameters

array|string $relations

Return Value

$this

in Model at line line 666
static Builder|Model with( array|string $relations)

Begin querying a model with eager loading.

Parameters

array|string $relations

Return Value

Builder|Model

in Model at line line 683
$this append( array|string $attributes)

Append attributes to query when building a query.

Parameters

array|string $attributes

Return Value

$this

in Model at line line 704
HasOne hasOne( string $related, string $foreignKey = null, string $localKey = null)

Define a one-to-one relationship.

Parameters

string $related
string $foreignKey
string $localKey

Return Value

HasOne

in Model at line line 725
MorphOne morphOne( string $related, string $name, string $type = null, string $id = null, string $localKey = null)

Define a polymorphic one-to-one relationship.

Parameters

string $related
string $name
string $type
string $id
string $localKey

Return Value

MorphOne

in Model at line line 747
BelongsTo belongsTo( string $related, string $foreignKey = null, string $otherKey = null, string $relation = null)

Define an inverse one-to-one or many relationship.

Parameters

string $related
string $foreignKey
string $otherKey
string $relation

Return Value

BelongsTo

in Model at line line 785
MorphTo morphTo( string $name = null, string $type = null, string $id = null)

Define a polymorphic, inverse one-to-one or many relationship.

Parameters

string $name
string $type
string $id

Return Value

MorphTo

in Model at line line 827
string getActualClassNameForMorph( string $class)

Retrieve the fully qualified class name from a slug.

Parameters

string $class

Return Value

string

in Model at line line 840
HasMany hasMany( string $related, string $foreignKey = null, string $localKey = null)

Define a one-to-many relationship.

Parameters

string $related
string $foreignKey
string $localKey

Return Value

HasMany

in Model at line line 861
HasManyThrough hasManyThrough( string $related, string $through, string|null $firstKey = null, string|null $secondKey = null, string|null $localKey = null)

Define a has-many-through relationship.

Parameters

string $related
string $through
string|null $firstKey
string|null $secondKey
string|null $localKey

Return Value

HasManyThrough

in Model at line line 884
MorphMany morphMany( string $related, string $name, string $type = null, string $id = null, string $localKey = null)

Define a polymorphic one-to-many relationship.

Parameters

string $related
string $name
string $type
string $id
string $localKey

Return Value

MorphMany

in Model at line line 910
BelongsToMany belongsToMany( string $related, string $table = null, string $foreignKey = null, string $otherKey = null, string $relation = null)

Define a many-to-many relationship.

Parameters

string $related
string $table
string $foreignKey
string $otherKey
string $relation

Return Value

BelongsToMany

in Model at line line 954
MorphToMany morphToMany( string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null, bool $inverse = false)

Define a polymorphic many-to-many relationship.

Parameters

string $related
string $name
string $table
string $foreignKey
string $otherKey
bool $inverse

Return Value

MorphToMany

in Model at line line 990
MorphToMany morphedByMany( string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null)

Define a polymorphic, inverse many-to-many relationship.

Parameters

string $related
string $name
string $table
string $foreignKey
string $otherKey

Return Value

MorphToMany

in Model at line line 1026
string joiningTable( string $related)

Get the joining table name for a many-to-many relation.

Parameters

string $related

Return Value

string

in Model at line line 1051
static int destroy( array|int $ids)

Destroy the models for the given IDs.

Parameters

array|int $ids

Return Value

int

at line line 45
bool|null delete()

Delete the pivot model record from the database.

Return Value

bool|null

in Model at line line 1119
bool|null forceDelete()

Force a hard delete on a soft deleted model.

This method protects developers from running forceDelete when trait is missing.

Return Value

bool|null

in Model at line line 1141
static void saving( Closure|string $callback, int $priority)

Register a saving model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in Model at line line 1153
static void saved( Closure|string $callback, int $priority)

Register a saved model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in Model at line line 1165
static void updating( Closure|string $callback, int $priority)

Register an updating model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in Model at line line 1177
static void updated( Closure|string $callback, int $priority)

Register an updated model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in Model at line line 1189
static void creating( Closure|string $callback, int $priority)

Register a creating model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in Model at line line 1201
static void created( Closure|string $callback, int $priority)

Register a created model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in Model at line line 1213
static void deleting( Closure|string $callback, int $priority)

Register a deleting model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in Model at line line 1225
static void deleted( Closure|string $callback, int $priority)

Register a deleted model event with the dispatcher.

Parameters

Closure|string $callback
int $priority

Return Value

void

in Model at line line 1235
static void flushEventListeners()

Remove all of the event listeners for the model.

Return Value

void

in Model at line line 1270
array getObservableEvents()

Get the observable event names.

Return Value

array

in Model at line line 1288
$this setObservableEvents( array $observables)

Set the observable event names.

Parameters

array $observables

Return Value

$this

in Model at line line 1301
void addObservableEvents( array|mixed $observables)

Add an observable event name.

Parameters

array|mixed $observables

Return Value

void

in Model at line line 1314
void removeObservableEvents( array|mixed $observables)

Remove an observable event name.

Parameters

array|mixed $observables

Return Value

void

in Model at line line 1387
bool|int update( array $attributes = array())

Update the model in the database.

Parameters

array $attributes

Return Value

bool|int

in Model at line line 1401
bool push()

Save the model and all of its relationships.

Return Value

bool

in Model at line line 1430
bool save( array $options = array())

Save the model to the database.

Parameters

array $options

Return Value

bool

in Model at line line 1470
bool saveOrFail( array $options = array())

Save the model to the database using transaction.

Parameters

array $options

Return Value

bool

Exceptions

Throwable

in Model at line line 1602
void touchOwners()

Touch the owning relations of the model.

Return Value

void

in Model at line line 1625
bool touches( string $relation)

Determine if the model touches a given relation.

Parameters

string $relation

Return Value

bool

in Model at line line 1685
bool touch()

Update the model's update timestamp.

Return Value

bool

in Model at line line 1720
$this setCreatedAt( mixed $value)

Set the value of the "created at" attribute.

Parameters

mixed $value

Return Value

$this

in Model at line line 1733
$this setUpdatedAt( mixed $value)

Set the value of the "updated at" attribute.

Parameters

mixed $value

Return Value

$this

in Pivot at line line 160
string getCreatedAtColumn()

Get the name of the "created at" column.

Return Value

string

in Pivot at line line 170
string getUpdatedAtColumn()

Get the name of the "updated at" column.

Return Value

string

in Model at line line 1765
Carbon freshTimestamp()

Get a fresh timestamp for the model.

Return Value

Carbon

in Model at line line 1775
string freshTimestampString()

Get a fresh timestamp for the model.

Return Value

string

in Model at line line 1785
Builder newQuery()

Get a new query builder for the model's table.

Return Value

Builder

in Model at line line 1798
Builder newQueryWithoutScope( ScopeInterface $scope)

Get a new query instance without a given scope.

Parameters

ScopeInterface $scope

Return Value

Builder

in Model at line line 1810
Builder|Model newQueryWithoutScopes()

Get a new query builder that doesn't have any global scopes.

Return Value

Builder|Model

in Model at line line 1828
Builder applyGlobalScopes( Builder $builder)

Apply all of the global scopes to an Eloquent builder.

Parameters

Builder $builder

Return Value

Builder

in Model at line line 1843
Builder removeGlobalScopes( Builder $builder)

Remove all of the global scopes from an Eloquent builder.

Parameters

Builder $builder

Return Value

Builder

in Model at line line 1858
Builder|Model newEloquentBuilder( Builder $query)

Create a new Eloquent query builder for the model.

Parameters

Builder $query

Return Value

Builder|Model

in Model at line line 1883
Collection newCollection( array $models = array())

Create a new Eloquent Collection instance.

Parameters

array $models

Return Value

Collection

in Model at line line 1897
Pivot newPivot( Model $parent, array $attributes, string $table, bool $exists)

Create a new pivot model instance.

Parameters

Model $parent
array $attributes
string $table
bool $exists

Return Value

Pivot

in Model at line line 1907
string getTable()

Get the table associated with the model.

Return Value

string

in Model at line line 1922
$this setTable( string $table)

Set the table associated with the model.

Parameters

string $table

Return Value

$this

in Model at line line 1934
mixed getKey()

Get the value of the model's primary key.

Return Value

mixed

in Model at line line 1944
mixed getQueueableId()

Get the queueable identity for the entity.

Return Value

mixed

in Model at line line 1954
string getKeyName()

Get the primary key for the model.

Return Value

string

in Model at line line 1965
$this setKeyName( string $key)

Set the primary key for the model.

Parameters

string $key

Return Value

$this

in Model at line line 1977
string getQualifiedKeyName()

Get the table qualified key name.

Return Value

string

in Model at line line 1987
mixed getRouteKey()

Get the value of the model's route key.

Return Value

mixed

in Model at line line 1997
string getRouteKeyName()

Get the route key for the model.

Return Value

string

in Model at line line 2007
bool usesTimestamps()

Determine if the model uses timestamps.

Return Value

bool

in Model at line line 2034
string getMorphClass()

Get the class name for polymorphic relations.

Return Value

string

in Model at line line 2052
int getPerPage()

Get the number of models to return per page.

Return Value

int

in Model at line line 2063
$this setPerPage( int $perPage)

Set the number of models to return per page.

Parameters

int $perPage

Return Value

$this

in Pivot at line line 114
string getForeignKey()

Get the foreign key column name.

Return Value

string

in Model at line line 2085
array getHidden()

Get the hidden attributes for the model.

Return Value

array

in Model at line line 2096
$this setHidden( array $hidden)

Set the hidden attributes for the model.

Parameters

array $hidden

Return Value

$this

in Model at line line 2109
void addHidden( array|string|null $attributes = null)

Add hidden attributes for the model.

Parameters

array|string|null $attributes

Return Value

void

in Model at line line 2122
$this withHidden( array|string $attributes)

Make the given, typically hidden, attributes visible.

Parameters

array|string $attributes

Return Value

$this

in Model at line line 2134
array getVisible()

Get the visible attributes for the model.

Return Value

array

in Model at line line 2145
$this setVisible( array $visible)

Set the visible attributes for the model.

Parameters

array $visible

Return Value

$this

in Model at line line 2158
void addVisible( array|string|null $attributes = null)

Add visible attributes for the model.

Parameters

array|string|null $attributes

Return Value

void

in Model at line line 2171
$this setAppends( array $appends)

Set the accessors to append to model arrays.

Parameters

array $appends

Return Value

$this

in Model at line line 2183
array getFillable()

Get the fillable attributes for the model.

Return Value

array

in Model at line line 2194
$this fillable( array $fillable)

Set the fillable attributes for the model.

Parameters

array $fillable

Return Value

$this

in Model at line line 2206
array getGuarded()

Get the guarded attributes for the model.

Return Value

array

in Model at line line 2217
$this guard( array $guarded)

Set the guarded attributes for the model.

Parameters

array $guarded

Return Value

$this

in Model at line line 2230
static void unguard( bool $state = true)

Disable all mass assignable restrictions.

Parameters

bool $state

Return Value

void

in Model at line line 2240
static void reguard()

Enable the mass assignment restrictions.

Return Value

void

in Model at line line 2250
static bool isUnguarded()

Determine if current state is "unguarded".

Return Value

bool

in Model at line line 2261
static mixed unguarded( callable $callback)

Run the given callable while being unguarded.

Parameters

callable $callback

Return Value

mixed

in Model at line line 2282
bool isFillable( string $key)

Determine if the given attribute may be mass assigned.

Parameters

string $key

Return Value

bool

in Model at line line 2308
bool isGuarded( string $key)

Determine if the given key is guarded.

Parameters

string $key

Return Value

bool

in Model at line line 2318
bool totallyGuarded()

Determine if the model is totally guarded.

Return Value

bool

in Model at line line 2343
array getTouchedRelations()

Get the relationships that are touched on save.

Return Value

array

in Model at line line 2354
$this setTouchedRelations( array $touches)

Set the relationships that are touched on save.

Parameters

array $touches

Return Value

$this

in Model at line line 2366
bool getIncrementing()

Get the value indicating whether the IDs are incrementing.

Return Value

bool

in Model at line line 2377
$this setIncrementing( bool $value)

Set whether IDs are incrementing.

Parameters

bool $value

Return Value

$this

in Model at line line 2390
string toJson( int $options)

Convert the model instance to JSON.

Parameters

int $options

Return Value

string

in Model at line line 2400
array jsonSerialize()

Convert the object into something JSON serializable.

Return Value

array

in Model at line line 2410
array toArray()

Convert the model instance to an array.

Return Value

array

in Model at line line 2422
array attributesToArray()

Convert the model's attributes to an array.

Return Value

array

in Model at line line 2509
array relationsToArray()

Get the model's relationships in array form.

Return Value

array

in Model at line line 2579
mixed getAttribute( string $key)

Get an attribute from the model.

Parameters

string $key

Return Value

mixed

in Model at line line 2594
mixed getAttributeValue( string $key)

Get a plain attribute (not a relationship).

Parameters

string $key

Return Value

mixed

in Model at line line 2630
mixed getRelationValue( string $key)

Get a relationship.

Parameters

string $key

Return Value

mixed

in Model at line line 2686
bool hasGetMutator( string $key)

Determine if a get mutator exists for an attribute.

Parameters

string $key

Return Value

bool

in Model at line line 2811
$this setAttribute( string $key, mixed $value)

Set a given attribute on the model.

Parameters

string $key
mixed $value

Return Value

$this

in Model at line line 2844
bool hasSetMutator( string $key)

Determine if a set mutator exists for an attribute.

Parameters

string $key

Return Value

bool

in Model at line line 2854
array getDates()

Get the attributes that should be converted to dates.

Return Value

array

in Model at line line 2867
string fromDateTime( DateTime|int $value)

Convert a DateTime to a storable string.

Parameters

DateTime|int $value

Return Value

string

in Model at line line 2945
$this setDateFormat( string $format)

Set the date format used by the model.

Parameters

string $format

Return Value

$this

in Model at line line 2970
mixed fromJson( string $value, bool $asObject = false)

Decode the given JSON back into an array or object.

Parameters

string $value
bool $asObject

Return Value

mixed

in Model at line line 2981
Model replicate( array $except = null)

Clone the model into a new, non-existing instance.

Parameters

array $except

Return Value

Model

in Model at line line 3001
array getAttributes()

Get all of the current attributes on the model.

Return Value

array

in Model at line line 3013
$this setRawAttributes( array $attributes, bool $sync = false)

Set the array of model attributes. No checking is done.

Parameters

array $attributes
bool $sync

Return Value

$this

in Model at line line 3031
array getOriginal( string|null $key = null, mixed $default = null)

Get the model's original attribute values.

Parameters

string|null $key
mixed $default

Return Value

array

in Model at line line 3041
$this syncOriginal()

Sync the original attributes with the current.

Return Value

$this

in Model at line line 3054
$this syncOriginalAttribute( string $attribute)

Sync a single original attribute with its current value.

Parameters

string $attribute

Return Value

$this

in Model at line line 3067
bool isDirty( array|string|null $attributes = null)

Determine if the model or given attribute(s) have been modified.

Parameters

array|string|null $attributes

Return Value

bool

in Model at line line 3093
array getDirty()

Get the attributes that have been changed since last sync.

Return Value

array

in Model at line line 3129
array getRelations()

Get all the loaded relations for the instance.

Return Value

array

in Model at line line 3140
mixed getRelation( string $relation)

Get a specified relationship.

Parameters

string $relation

Return Value

mixed

in Model at line line 3151
bool relationLoaded( string $key)

Determine if the given relation is loaded.

Parameters

string $key

Return Value

bool

in Model at line line 3163
$this setRelation( string $relation, mixed $value)

Set the specific relationship in the model.

Parameters

string $relation
mixed $value

Return Value

$this

in Model at line line 3176
$this setRelations( array $relations)

Set the entire relations array on the model.

Parameters

array $relations

Return Value

$this

in Model at line line 3188
Connection getConnection()

Get the database connection for the model.

Return Value

Connection

in Model at line line 3198
string getConnectionName()

Get the current connection name for the model.

Return Value

string

in Model at line line 3209
$this setConnection( string $name)

Set the connection associated with the model.

Parameters

string $name

Return Value

$this

in Model at line line 3222
static Connection resolveConnection( string|null $connection = null)

Resolve a connection instance.

Parameters

string|null $connection

Return Value

Connection

in Model at line line 3232
static ConnectionResolverInterface getConnectionResolver()

Get the connection resolver instance.

in Model at line line 3243
static void setConnectionResolver( ConnectionResolverInterface $resolver)

Set the connection resolver instance.

Parameters

ConnectionResolverInterface $resolver

Return Value

void

in Model at line line 3253
static void unsetConnectionResolver()

Unset the connection resolver for models.

Return Value

void

in Model at line line 3263
static Dispatcher getEventDispatcher()

Get the event dispatcher instance.

Return Value

Dispatcher

in Model at line line 3274
static void setEventDispatcher( Dispatcher $dispatcher)

Set the event dispatcher instance.

Parameters

Dispatcher $dispatcher

Return Value

void

in Model at line line 3284
static void unsetEventDispatcher()

Unset the event dispatcher for models.

Return Value

void

in Model at line line 3294
array getMutatedAttributes()

Get the mutated attributes for a given instance.

Return Value

array

in Model at line line 3311
static void cacheMutatedAttributes( string $class)

Extract and cache all the mutated attributes of a class.

Parameters

string $class

Return Value

void

in Model at line line 3337
mixed __get( string $key)

Dynamically retrieve attributes on the model.

Parameters

string $key

Return Value

mixed

in Model at line line 3349
void __set( string $key, mixed $value)

Dynamically set attributes on the model.

Parameters

string $key
mixed $value

Return Value

void

in Model at line line 3360
bool offsetExists( mixed $offset)

Determine if the given attribute exists.

Parameters

mixed $offset

Return Value

bool

in Model at line line 3371
mixed offsetGet( mixed $offset)

Get the value for a given offset.

Parameters

mixed $offset

Return Value

mixed

in Model at line line 3383
void offsetSet( mixed $offset, mixed $value)

Set the value for a given offset.

Parameters

mixed $offset
mixed $value

Return Value

void

in Model at line line 3394
void offsetUnset( mixed $offset)

Unset the value for a given offset.

Parameters

mixed $offset

Return Value

void

in Model at line line 3405
bool __isset( string $key)

Determine if an attribute exists on the model.

Parameters

string $key

Return Value

bool

in Model at line line 3417
void __unset( string $key)

Unset an attribute on the model.

Parameters

string $key

Return Value

void

in Model at line line 3429
mixed __call( string $method, array $parameters)

Handle dynamic method calls into the model.

Parameters

string $method
array $parameters

Return Value

mixed

in Model at line line 3447
static mixed __callStatic( string $method, array $parameters)

Handle dynamic static method calls into the method.

Parameters

string $method
array $parameters

Return Value

mixed

in Model at line line 3459
string __toString()

Convert the model to its string representation.

Return Value

string

in Model at line line 3469
void __wakeup()

When a model is being unserialized, check if it needs to be booted.

Return Value

void

in Pivot at line line 124
string getOtherKey()

Get the "other key" column name.

Return Value

string

in Pivot at line line 136
$this setPivotKeys( string $foreignKey, string $otherKey)

Set the key names for the pivot model instance.

Parameters

string $foreignKey
string $otherKey

Return Value

$this

in Pivot at line line 150
bool hasTimestampAttributes()

Determine if the pivot model has timestamp attributes.

Return Value

bool

at line line 60
$this setMorphType( string $morphType)

Set the morph type for the pivot.

Parameters

string $morphType

Return Value

$this

at line line 73
MorphPivot setMorphClass( string $morphClass)

Set the morph class for the pivot.

Parameters

string $morphClass

Return Value

MorphPivot