PHP Класс LMongo\Eloquent\Relations\BelongsToMany

Наследование: extends HasOneOrMany
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$foreignKey string The foreign key of the parent model.
$otherKey string The associated key of the relation.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
buildDictionary ( Collection $results ) : array Build model dictionary keyed by the relation's foreign key.

Описание методов

__construct() публичный Метод

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
Результат void

attach() публичный Метод

Attach a model to the parent.
public attach ( mixed $related ) : void
$related mixed
Результат void

buildDictionary() защищенный Метод

Build model dictionary keyed by the relation's foreign key.
protected buildDictionary ( Collection $results ) : array
$results LMongo\Eloquent\Collection
Результат array

create() публичный Метод

Create a new instance of the related model.
public create ( array $attributes ) : Model
$attributes array
Результат LMongo\Eloquent\Model

createMany() публичный Метод

Create an array of new instances of the related models.
public createMany ( array $records ) : Model
$records array
Результат LMongo\Eloquent\Model

detach() публичный Метод

Detach models from the relationship.
public detach ( integer $related ) : void
$related integer
Результат void

getOtherKey() публичный Метод

Get the other key for the relationship.
public getOtherKey ( ) : string
Результат string

getResults() публичный Метод

Get the results of the relationship.
public getResults ( ) : mixed
Результат mixed

initRelation() публичный Метод

Initialize the relation on a set of models.
public initRelation ( array $models, string $relation ) : void
$models array
$relation string
Результат void

match() публичный Метод

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
Результат array

save() публичный Метод

Save a new model and attach it to the parent model.
public save ( Model $model ) : Model
$model LMongo\Eloquent\Model
Результат LMongo\Eloquent\Model

saveMany() публичный Метод

Save an array of new models and attach them to the parent model.
public saveMany ( array $models ) : array
$models array
Результат array

sync() публичный Метод

Sync the intermediate tables with a list of IDs.
public sync ( array $ids ) : void
$ids array
Результат void

Описание свойств

$foreignKey защищенное свойство

The foreign key of the parent model.
protected string $foreignKey
Результат string

$otherKey защищенное свойство

The associated key of the relation.
protected string $otherKey
Результат string