Properties

$model

$model : \Laravel\Database\Eloquent\Model

The model instance being queried.

Type

LaravelDatabaseEloquentModel

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

$table

$table : \Laravel\Database\Eloquent\Query

The fluent query builder for the query instance.

Type

LaravelDatabaseEloquentQuery

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

$includes

$includes : array

The relationships that should be eagerly loaded by the query.

Type

array

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

$passthru

$passthru : array

The methods that should be returned from the fluent query builder.

Type

array

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

$base

$base : \Laravel\Database\Eloquent\Model

The base model for the relationship.

Type

LaravelDatabaseEloquentModel

$joining

$joining : string

The name of the intermediate, joining table.

Type

string

Tags

None found

$other

$other : string

The other or "associated" key. This is the foreign key of the related model.

Type

string

Tags

None found

$with

$with : array

The columns on the joining table that should be fetched.

Type

array

Tags

None found

Methods

__construct()

__construct(\Laravel\Database\Eloquent\Model  $model, string  $associated, string  $table, string  $foreign, string  $other) : void

Create a new many to many relationship instance.

Parameters

LaravelDatabaseEloquentModel $model
string $associated
string $table
string $foreign
string $other

Tags

None found

foreign()

foreign(string  $model, string  $foreign = null) : string

Get the foreign key name for the given model.

Parameters

string $model
string $foreign

Returns

string

static
Inherited from
LaravelDatabaseEloquentRelationshipsRelationship

Tags

None found

foreign_key()

foreign_key() : string

Get the foreign key for the relationship.

Returns

string

keys()

keys(array  $results) : array

Gather all the primary keys from a result set.

Parameters

array $results

Returns

array

with()

with(  $columns) : \Laravel\Database\Eloquent\Relationships\Relationship

Set the columns on the joining table that should be fetched.

Parameters

$columns

Returns

LaravelDatabaseEloquentRelationshipsRelationship

Tags

None found

find()

find(mixed  $id, array  $columns = array('*')) : mixed

Find a model by its primary key.

Parameters

mixed $id
array $columns

Returns

mixed

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

first()

first(array  $columns = array('*')) : mixed

Get the first model result for the query.

Parameters

array $columns

Returns

mixed

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

get()

get(array  $columns = array('*')) : array

Get all of the model results for the query.

Parameters

array $columns

Returns

array

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

paginate()

paginate(integer  $per_page = null, array  $columns = array('*')) : \Laravel\Database\Eloquent\Paginator

Get an array of paginated model results.

Parameters

integer $per_page
array $columns

Returns

LaravelDatabaseEloquentPaginator

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

hydrate()

hydrate(\Laravel\Database\Eloquent\Model  $model, array  $results) : array

Hydrate an array of models from the given results.

Parameters

LaravelDatabaseEloquentModel $model
array $results

Returns

array

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

connection()

connection() : \Laravel\Database\Eloquent\Connection

Get the database connection for the model.

Returns

LaravelDatabaseEloquentConnection

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

__call()

__call(string  $method, array  $parameters) : mixed

Handle dynamic method calls to the query.

Parameters

string $method
array $parameters

Returns

mixed

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

results()

results() : array

Get the properly hydrated results for the relationship.

Returns

array

Tags

None found

attach()

attach(\Laravel\Database\Eloquent\Model|integer  $id, array  $attributes = array()) : boolean

Insert a new record into the joining table of the association.

Parameters

LaravelDatabaseEloquentModel|integer $id
array $attributes

Returns

boolean

Tags

None found

detach()

detach(array|\Laravel\Database\Eloquent\Model|integer  $ids) : boolean

Detach a record from the joining table of the association.

Parameters

array|LaravelDatabaseEloquentModel|integer $ids

Returns

boolean

Tags

None found

sync()

sync(array  $ids) : boolean

Sync the joining table with the array of given IDs.

Parameters

array $ids

Returns

boolean

Tags

None found

insert()

insert(\Laravel\Database\Eloquent\Model|array  $attributes, array  $joining = array()) : boolean

Insert a new record for the association.

Parameters

LaravelDatabaseEloquentModel|array $attributes
array $joining

Returns

boolean

Tags

None found

delete()

delete() : integer

Delete all of the records from the joining table for the model.

Returns

integer

Tags

None found

initialize()

initialize(array  $parents, string  $relationship) : void

Initialize a relationship on an array of parent models.

Parameters

array $parents
string $relationship

Tags

None found

eagerly_constrain()

eagerly_constrain(array  $results) : void

Set the proper constraints on the relationship table for an eager load.

Parameters

array $results

Tags

None found

match()

match(  $relationship, array  $parents, array  $children) : void

Match eagerly loaded child models to their parent models.

Parameters

$relationship
array $parents
array $children

Tags

None found

pivot()

pivot() : \Laravel\Database\Eloquent\Relationships\Has_Many

Get a relationship instance of the pivot table.

Returns

LaravelDatabaseEloquentRelationshipsHas_Many

Tags

None found

fresh_model()

fresh_model(array  $attributes = array()) : \Laravel\Database\Eloquent\Model

Get a freshly instantiated instance of the related model class.

Parameters

array $attributes

Returns

LaravelDatabaseEloquentModel

load()

load(array  $results, string  $relationship, array|null  $constraints) : void

Hydrate an eagerly loaded relationship on the model results.

Parameters

array $results
string $relationship
array|null $constraints

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

nested_includes()

nested_includes(string  $relationship) : array

Gather the nested includes for a given relationship.

Parameters

string $relationship

Returns

array

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

model_includes()

model_includes() : array

Get the eagerly loaded relationships for the model.

Returns

array

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

table()

table() : \Laravel\Database\Eloquent\Query

Get a fluent query builder for the model.

Returns

LaravelDatabaseEloquentQuery

Inherited from
LaravelDatabaseEloquentQuery

Tags

None found

joining()

joining(  $model,   $associated) : string

Determine the joining table name for the relationship.

By default, the name is the models sorted and joined with underscores.

Parameters

$model
$associated

Returns

string

Tags

None found

join_record()

join_record(integer  $id) : array

Create an array representing a new joining record for the association.

Parameters

integer $id

Returns

array

Tags

None found

insert_joining()

insert_joining(array  $attributes) : void

Insert a new record into the joining table of the association.

Parameters

array $attributes

Tags

None found

joining_table()

joining_table() : \Laravel\Database\Eloquent\Relationships\Query

Get a fluent query for the joining table of the relationship.

Returns

LaravelDatabaseEloquentRelationshipsQuery

Tags

None found

constrain()

constrain() : void

Set the proper constraints on the relationship table.

Tags

None found

set_select()

set_select(string  $foreign, string  $other) : void

Set the SELECT clause on the query builder for the relationship.

Parameters

string $foreign
string $other

Tags

None found

set_join()

set_join(string  $other) : void

Set the JOIN clause on the query builder for the relationship.

Parameters

string $other

Tags

None found

set_where()

set_where(string  $foreign) : void

Set the WHERE clause on the query builder for the relationship.

Parameters

string $foreign

Tags

None found

hydrate_pivot()

hydrate_pivot(array  $results) : void

Hydrate the Pivot model on an array of results.

Parameters

array $results

Tags

None found

other_key()

other_key() : string

Get the other or associated key for the relationship.

Returns

string

Tags

None found

associated_key()

associated_key() : string

Get the fully qualified associated table's primary key.

Returns

string

Tags

None found