class Illuminate / Database / Eloquent / Factories / BelongsToManyRelationship
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

BelongsToManyRelationship

Properties

protected

$factory Illuminate\...\Factory|Illuminate\...\Collection|Model |array

The related factory instance.

Default: null
protected

$pivot callable|array

The pivot attributes / attribute resolver.

Default: null
protected

$relationship string

The relationship name.

Default: null

Methods

public

__construct ( $factory , $pivot , $relationship ) : void

Create a new attached relationship definition.

Parameters

  • $factory Illuminate\...\Factory|Illuminate\...\Collection|Model |array
  • $pivot callable|array
  • $relationship string
public

createFor ( Model $model ) : void

Create the attached relationship for the given model.

Parameters

public

recycle ( $recycle ) : $this

Specify the model instances to always use when creating relationships.

Parameters

  • $recycle Illuminate\...\Collection