PHP Class LMongo\Eloquent\Relations\BelongsToMany

Inheritance: extends HasOneOrMany
Afficher le fichier Open project: navruzm/lmongo

Protected Properties

Свойство Type Description
$foreignKey string The foreign key of the parent model.
$otherKey string The associated key of the relation.

Méthodes publiques

Méthode Description
__construct ( Builder $query, Model $parent, string $foreignKey, string $otherKey ) : void Create a new has many relationship instance.
attach ( mixed $related ) : void Attach a model to the parent.
create ( array $attributes ) : Model Create a new instance of the related model.
createMany ( array $records ) : Model Create an array of new instances of the related models.
detach ( integer $related ) : void Detach models from the relationship.
getOtherKey ( ) : string Get the other key for the relationship.
getResults ( ) : mixed Get the results of the relationship.
initRelation ( array $models, string $relation ) : void Initialize the relation on a set of models.
match ( array $models, Collection $results, string $relation ) : array Match the eagerly loaded results to their parents.
save ( Model $model ) : Model Save a new model and attach it to the parent model.
saveMany ( array $models ) : array Save an array of new models and attach them to the parent model.
sync ( array $ids ) : void Sync the intermediate tables with a list of IDs.

Méthodes protégées

Méthode Description
buildDictionary ( Collection $results ) : array Build model dictionary keyed by the relation's foreign key.

Method Details

__construct() public méthode

Create a new has many relationship instance.
public __construct ( Builder $query, Model $parent, string $foreignKey, string $otherKey ) : void
$query LMongo\Eloquent\Builder
$parent LMongo\Eloquent\Model
$foreignKey string
$otherKey string
Résultat void

attach() public méthode

Attach a model to the parent.
public attach ( mixed $related ) : void
$related mixed
Résultat void

buildDictionary() protected méthode

Build model dictionary keyed by the relation's foreign key.
protected buildDictionary ( Collection $results ) : array
$results LMongo\Eloquent\Collection
Résultat array

create() public méthode

Create a new instance of the related model.
public create ( array $attributes ) : Model
$attributes array
Résultat LMongo\Eloquent\Model

createMany() public méthode

Create an array of new instances of the related models.
public createMany ( array $records ) : Model
$records array
Résultat LMongo\Eloquent\Model

detach() public méthode

Detach models from the relationship.
public detach ( integer $related ) : void
$related integer
Résultat void

getOtherKey() public méthode

Get the other key for the relationship.
public getOtherKey ( ) : string
Résultat string

getResults() public méthode

Get the results of the relationship.
public getResults ( ) : mixed
Résultat mixed

initRelation() public méthode

Initialize the relation on a set of models.
public initRelation ( array $models, string $relation ) : void
$models array
$relation string
Résultat void

match() public méthode

Match the eagerly loaded results to their parents.
public match ( array $models, Collection $results, string $relation ) : array
$models array
$results LMongo\Eloquent\Collection
$relation string
Résultat array

save() public méthode

Save a new model and attach it to the parent model.
public save ( Model $model ) : Model
$model LMongo\Eloquent\Model
Résultat LMongo\Eloquent\Model

saveMany() public méthode

Save an array of new models and attach them to the parent model.
public saveMany ( array $models ) : array
$models array
Résultat array

sync() public méthode

Sync the intermediate tables with a list of IDs.
public sync ( array $ids ) : void
$ids array
Résultat void

Property Details

$foreignKey protected_oe property

The foreign key of the parent model.
protected string $foreignKey
Résultat string

$otherKey protected_oe property

The associated key of the relation.
protected string $otherKey
Résultat string