class BelongsToMany extends Relation (View source)

Properties

protected string $foreign_key

The foreign key of the parent model.

from  Relation
protected string $local_key

The associated key on the parent model.

from  Relation
protected Model $parent

The parent model instance

from  Relation
$related

The related model instance

from  Relation
protected QueryBuilder $query

The Bow Query builder

from  Relation
static protected bool $has_constraints

Indicates whether the relation is adding constraints.

from  Relation
static protected bool $has_pivot

Indicate whether the relationships use a pivot table.*.

from  Relation

Methods

__construct(Model $related, Model $parent, string $foreign_key, string $local_key)

Create a new belongs to relationship instance.

getParent()

Get the parent model.

from  Relation
getRelated()

Get associated model class.

from  Relation
mixed
__call(string $method, array $args = [])

_Call

from  Relation
create(array $attributes)

Create a new row of the related

from  Relation
mixed
getResults()

Get the results of the relationship.

void
addConstraints()

Set the base constraints on the relation query.

Details

__construct(Model $related, Model $parent, string $foreign_key, string $local_key)

Create a new belongs to relationship instance.

Parameters

Model $related
Model $parent
string $foreign_key
string $local_key

Model getParent()

Get the parent model.

Return Value

Model

Model getRelated()

Get associated model class.

Return Value

Model

mixed __call(string $method, array $args = [])

_Call

Parameters

string $method
array $args

Return Value

mixed

Model create(array $attributes)

Create a new row of the related

Parameters

array $attributes

Return Value

Model

mixed getResults()

Get the results of the relationship.

Return Value

mixed

void addConstraints()

Set the base constraints on the relation query.

Return Value

void

Exceptions

QueryBuilderException