class MorphPivot extends Pivot (View source)
CREATED_AT | The name of the "created at" column. |
UPDATED_AT | The name of the "updated at" column. |
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 |
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 |
Model | newInstance(array $attributes = array(), bool $exists = false) Create a new instance of the given model. | from Model |
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 |
Model|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 | hasOne(string $related, string $foreignKey = null, string $localKey = null) Define a one-to-one relationship. | from Model |
MorphOne | morphOne(string $related, string $name, string $type = null, string $id = null, string $localKey = null) Define a polymorphic one-to-one relationship. | from Model |
BelongsTo | belongsTo(string $related, string $foreignKey = null, string $otherKey = null, string $relation = null) Define an inverse one-to-one or many relationship. | from Model |
MorphTo | 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 | hasMany(string $related, string $foreignKey = null, string $localKey = null) Define a one-to-many relationship. | from Model |
HasManyThrough | 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 | morphMany(string $related, string $name, string $type = null, string $id = null, string $localKey = null) Define a polymorphic one-to-many relationship. | from Model |
BelongsToMany | belongsToMany(string $related, string $table = null, string $foreignKey = null, string $otherKey = null, string $relation = null) Define a many-to-many relationship. | from Model |
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. | from Model |
MorphToMany | 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 |
Builder | newQuery() Get a new query builder for the model's table. | from Model |
Builder | newQueryWithoutScope(ScopeInterface $scope) Get a new query instance without a given scope. | from Model |
Builder|Model | newQueryWithoutScopes() Get a new query builder that doesn't have any global scopes. | from Model |
Builder | applyGlobalScopes(Builder $builder) Apply all of the global scopes to an Eloquent builder. | from Model |
Builder | removeGlobalScopes(Builder $builder) Remove all of the global scopes from an Eloquent builder. | from Model |
Builder|Model | newEloquentBuilder(Builder $query) Create a new Eloquent query builder for the model. | from Model |
Collection | newCollection(array $models = array()) Create a new Eloquent Collection instance. | from Model |
Pivot | 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 |
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 |
Connection | 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 |
static ConnectionResolverInterface | 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 or relation 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. | |
MorphPivot | setMorphClass(string $morphClass) Set the morph class for the pivot. |
Create a new pivot model instance.
Clear the list of booted models so they will be re-booted.
Register a new global scope on the model.
Determine if a model has a global scope.
Get a global scope registered with the model.
Get the global scopes for this class instance.
Register an observer with the Model.
Fill the model with an array of attributes.
Fill the model with an array of attributes. Force mass assignment.
Create a new instance of the given model.
Create a new model instance that is existing.
Create a collection of models from plain arrays.
Create a collection of models from a raw query.
Save a new model and return the instance.
Save a new model and return the instance. Allow mass-assignment.
Begin querying the model.
Begin querying the model on a given connection.
Begin querying the model on the write connection.
Get all of the models from the database.
Reload a fresh model instance from the database.
Eager load relations on the model.
Append attributes to query when building a query.
Define a one-to-one relationship.
Define a polymorphic one-to-one relationship.
Define an inverse one-to-one or many relationship.
Define a polymorphic, inverse one-to-one or many relationship.
Retrieve the fully qualified class name from a slug.
Define a one-to-many relationship.
Define a has-many-through relationship.
Define a polymorphic one-to-many relationship.
Define a many-to-many relationship.
Define a polymorphic many-to-many relationship.
Define a polymorphic, inverse many-to-many relationship.
Get the joining table name for a many-to-many relation.
Destroy the models for the given IDs.
Delete the pivot model record from the database.
Force a hard delete on a soft deleted model.
This method protects developers from running forceDelete when trait is missing.
Register a saving model event with the dispatcher.
Register a saved model event with the dispatcher.
Register an updating model event with the dispatcher.
Register an updated model event with the dispatcher.
Register a creating model event with the dispatcher.
Register a created model event with the dispatcher.
Register a deleting model event with the dispatcher.
Register a deleted model event with the dispatcher.
Remove all of the event listeners for the model.
Get the observable event names.
Set the observable event names.
Add an observable event name.
Remove an observable event name.
Update the model in the database.
Save the model and all of its relationships.
Save the model to the database.
Save the model to the database using transaction.
Touch the owning relations of the model.
Determine if the model touches a given relation.
Update the model's update timestamp.
Set the value of the "created at" attribute.
Set the value of the "updated at" attribute.
Get the name of the "created at" column.
Get the name of the "updated at" column.
Get a fresh timestamp for the model.
Get a fresh timestamp for the model.
Get a new query builder for the model's table.
Get a new query instance without a given scope.
Remove all of the global scopes from an Eloquent builder.
Create a new Eloquent Collection instance.
Create a new pivot model instance.
Get the table associated with the model.
Set the table associated with the model.
Get the value of the model's primary key.
Get the queueable identity for the entity.
Get the primary key for the model.
Set the primary key for the model.
Get the table qualified key name.
Get the value of the model's route key.
Get the route key for the model.
Determine if the model uses timestamps.
Get the class name for polymorphic relations.
Get the number of models to return per page.
Set the number of models to return per page.
Get the foreign key column name.
Get the hidden attributes for the model.
Set the hidden attributes for the model.
Add hidden attributes for the model.
Make the given, typically hidden, attributes visible.
Get the visible attributes for the model.
Set the visible attributes for the model.
Add visible attributes for the model.
Set the accessors to append to model arrays.
Get the fillable attributes for the model.
Set the fillable attributes for the model.
Get the guarded attributes for the model.
Set the guarded attributes for the model.
Disable all mass assignable restrictions.
Enable the mass assignment restrictions.
Determine if current state is "unguarded".
Run the given callable while being unguarded.
Determine if the given attribute may be mass assigned.
Determine if the given key is guarded.
Determine if the model is totally guarded.
Get the relationships that are touched on save.
Set the relationships that are touched on save.
Get the value indicating whether the IDs are incrementing.
Set whether IDs are incrementing.
Convert the model instance to JSON.
Convert the object into something JSON serializable.
Convert the model instance to an array.
Convert the model's attributes to an array.
Get the model's relationships in array form.
Get an attribute from the model.
Get a plain attribute (not a relationship).
Get a relationship.
Determine if a get mutator exists for an attribute.
Set a given attribute on the model.
Determine if a set mutator exists for an attribute.
Get the attributes that should be converted to dates.
Convert a DateTime to a storable string.
Set the date format used by the model.
Decode the given JSON back into an array or object.
Clone the model into a new, non-existing instance.
Get all of the current attributes on the model.
Set the array of model attributes. No checking is done.
Get the model's original attribute values.
Sync the original attributes with the current.
Sync a single original attribute with its current value.
Determine if the model or given attribute(s) have been modified.
Get the attributes that have been changed since last sync.
Get all the loaded relations for the instance.
Get a specified relationship.
Determine if the given relation is loaded.
Set the specific relationship in the model.
Set the entire relations array on the model.
Get the database connection for the model.
Get the current connection name for the model.
Set the connection associated with the model.
Resolve a connection instance.
Get the connection resolver instance.
Set the connection resolver instance.
Unset the connection resolver for models.
Get the event dispatcher instance.
Set the event dispatcher instance.
Unset the event dispatcher for models.
Get the mutated attributes for a given instance.
Extract and cache all the mutated attributes of a class.
Dynamically retrieve attributes on the model.
Dynamically set attributes on the model.
Determine if the given attribute exists.
Get the value for a given offset.
Set the value for a given offset.
Unset the value for a given offset.
Determine if an attribute or relation exists on the model.
Unset an attribute on the model.
Handle dynamic method calls into the model.
Handle dynamic static method calls into the method.
Convert the model to its string representation.
When a model is being unserialized, check if it needs to be booted.
Get the "other key" column name.
Set the key names for the pivot model instance.
Determine if the pivot model has timestamp attributes.
Set the morph type for the pivot.
Set the morph class for the pivot.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Database/Eloquent/Relations/MorphPivot.html