Class Model

Direct known subclasses

Laravel\Database\Eloquent\Pivot
Abstract
Namespace: Laravel\Database\Eloquent
Located at database/eloquent/model.php
Methods summary
public
# __construct( array $attributes = array(), boolean $exists = false )

Create a new Eloquent model instance.

public Laravel\Database\Eloquent\Model
# fill( array $attributes, boolean $raw = false )

Hydrate the model with an array of attributes.

public Laravel\Database\Eloquent\Model
# fill_raw( array $attributes )

Fill the model with the contents of the array.

public static
# accessible( array $attributes = null )

Set the accessible attributes for the given model.

public static Laravel\Database\Eloquent\Model|false
# create( array $attributes )

Create a new model and store it in the database.

public static integer
# update( mixed $id, array $attributes )

Update a model instance in the database.

public static Laravel\Database\Eloquent\Model
# find( string $id, array $columns = array('*') )

Find a model by its primary key.

public static array
# all( )

Get all of the models in the database.

public Laravel\Database\Eloquent\Model
# _with( array $includes )

The relationships that should be eagerly loaded by the query.

public Relationship
# has_one( string $model, string $foreign = null )

Get the query for a one-to-one association.

public Relationship
# has_many( string $model, string $foreign = null )

Get the query for a one-to-many association.

protected Relationship
# has_one_or_many( string $type, string $model, string $foreign )

Get the query for a one-to-one / many association.

public Relationship
# belongs_to( string $model, string $foreign = null )

Get the query for a one-to-one (inverse) relationship.

public Relationship
# has_many_and_belongs_to( string $model, string $table = null, string $foreign = null, string $other = null )

Get the query for a many-to-many relationship.

public boolean
# push( )

Save the model and all of its relations to the database.

public boolean
# save( )

Save the model instance to the database.

public integer
# delete( )

Delete the model from the database.

protected
# timestamp( )

Set the update and creation timestamps on the model.

protected Laravel\Database\Eloquent\Query
# query( )

Get a new fluent query builder instance for the model.

final public boolean
# sync( )

Sync the original attributes with the current attributes.

public boolean
# changed( string $attribute )

Determine if a given attribute has changed from its original state.

public boolean
# dirty( )

Determine if the model has been changed from its original state.

public string
# table( )

Get the name of the table associated with the model.

public array
# get_dirty( )

Get the dirty attributes for the model.

public integer
# get_key( )

Get the value of the primary key for the model.

public
# set_key( integer $value )

Set the value of the primary key for the model.

public
# get_attribute( string $key )

Get a given attribute from the model.

public
# set_attribute( string $key, mixed $value )

Set an attribute's value on the model.

final public
# purge( string $key )

Remove an attribute from the model.

public array
# to_array( )

Get the model attributes and relationships in array form.

protected array
# fire_event( string $event )

Fire a given event for the model.

public mixed
# __get( string $key )

Handle the dynamic retrieval of attributes and associations.

public
# __set( string $key, mixed $value )

Handle the dynamic setting of attributes.

public boolean
# __isset( string $key )

Determine if an attribute exists on the model.

public
# __unset( string $key )

Remove an attribute from the model.

public mixed
# __call( string $method, array $parameters )

Handle dynamic method calls on the model.

public static mixed
# __callStatic( string $method, array $parameters )

Dynamically handle static method calls on the model.

Properties summary
public array $attributes array()
#

All of the model's attributes.

public array $original array()
#

The model's attributes in their original state.

public array $relationships array()
#

The relationships that have been loaded for the query.

public boolean $exists false
#

Indicates if the model exists in the database.

public array $includes array()
#

The relationships that should be eagerly loaded.

public static string $key 'id'
#

The primary key for the model on the database table.

public static array $accessible
#

The attributes that are accessible for mass assignment.

public static array $hidden array()
#

The attributes that should be excluded from to_array.

public static boolean $timestamps true
#

Indicates if the model has update and creation timestamps.

public static string $table
#

The name of the table associated with the model.

public static string $connection
#

The name of the database connection that should be used for the model.

public static string $sequence
#

The name of the sequence associated with the model.

public static integer $per_page 20
#

The default number of models to show per page when paginating.