$manyMethodsExtended
The many to many relationship methods.
public
static array
$manyMethodsExtended
= ['belongsToMany', 'morphToMany', 'morphedByMany', 'morphToManyUnique']
HasRelationships trait.
Extends Laravel's Model class to add some additional relationships.
$manyMethodsExtended | The many to many relationship methods. | array |
---|---|---|
hasMany() | Overrides the default Eloquent hasMany relationship to return a HasManySyncable. | trait:short |
morphMany() | Overrides the default Eloquent morphMany relationship to return a MorphManySyncable. | trait:short |
belongsToManyThrough() | Define a many-to-many 'through' relationship. | trait:short |
belongsToManyUnique() | Define a unique many-to-many relationship. Similar to a regular many-to-many relationship, but removes duplicate child objects. | trait:short |
morphToManyUnique() | Define a unique morphs-to-many relationship. Similar to a regular morphs-to-many relationship, but removes duplicate child objects. | trait:short |
getBelongsToManyCaller() | Get the relationship name of the belongs to many. | string |
The many to many relationship methods.
public
static array
$manyMethodsExtended
= ['belongsToMany', 'morphToMany', 'morphedByMany', 'morphToManyUnique']
Overrides the default Eloquent hasMany relationship to return a HasManySyncable.
public
hasMany(
$related :
string
[, $foreignKey :
string
= null ]
[, $localKey :
string
= null ]
)
: HasManySyncable
Overrides the default Eloquent morphMany relationship to return a MorphManySyncable.
public
morphMany(
$related :
string
, $name :
string
[, $type :
string
= null ]
[, $id :
string
= null ]
[, $localKey :
string
= null ]
)
: MorphManySyncable
Define a many-to-many 'through' relationship.
public
belongsToManyThrough(
$related :
string
, $through :
string
[, $firstJoiningTable :
string
= null ]
[, $firstForeignPivotKey :
string
= null ]
[, $firstRelatedKey :
string
= null ]
[, $secondJoiningTable :
string
= null ]
[, $secondForeignPivotKey :
string
= null ]
[, $secondRelatedKey :
string
= null ]
[, $throughRelation :
string
= null ]
[, $relation :
string
= null ]
)
: BelongsToManyThrough
This is basically hasManyThrough for many-to-many relationships.
Define a unique many-to-many relationship. Similar to a regular many-to-many relationship, but removes duplicate child objects.
public
belongsToManyUnique(
$related :
string
[, $table :
string
= null ]
[, $foreignPivotKey :
string
= null ]
[, $relatedPivotKey :
string
= null ]
[, $parentKey :
string
= null ]
[, $relatedKey :
string
= null ]
[, $relation :
string
= null ]
)
: BelongsToManyUnique
Can also be used to implement ternary relationships.
Define a unique morphs-to-many relationship. Similar to a regular morphs-to-many relationship, but removes duplicate child objects.
public
morphToManyUnique(
$related :
string
, $name :
string
[, $table :
string
= null ]
[, $foreignPivotKey :
string
= null ]
[, $relatedPivotKey :
string
= null ]
[, $parentKey :
string
= null ]
[, $relatedKey :
string
= null ]
[, $inverse :
bool
= false ]
)
: MorphToManyUnique
Get the relationship name of the belongs to many.
protected
getBelongsToManyCaller(
)
: string