PHP Класс Illuminate\Database\Eloquent\Relations\BelongsTo

Наследование: extends Illuminate\Database\Eloquent\Relations\Relation
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$foreignKey string The foreign key of the parent model.
$otherKey string The associated key on the parent model.
$relation string The name of the relationship.
$selfJoinCount integer The count of self joins.

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

Метод Описание
__construct ( Builder $query, Model $parent, string $foreignKey, string $otherKey, string $relation ) : void Create a new belongs to relationship instance.
addConstraints ( ) : void Set the base constraints on the relation query.
addEagerConstraints ( array $models ) : void Set the constraints for an eager load of the relation.
associate ( Model | integer $model ) : Model Associate the model instance to the given parent.
dissociate ( ) : Model Dissociate previously associated model from the given parent.
getForeignKey ( ) : string Get the foreign key of the relationship.
getOtherKey ( ) : string Get the associated key of the relationship.
getQualifiedForeignKey ( ) : string Get the fully qualified foreign key of the relationship.
getQualifiedOtherKeyName ( ) : string Get the fully qualified associated key of the relationship.
getRelation ( ) : string Get the name of the relationship.
getRelationCountHash ( ) : string Get a relationship join table hash.
getRelationQuery ( Builder $query, Builder $parent, array | mixed $columns = ['*'] ) : Builder Add the constraints for a relationship query.
getRelationQueryForSelfRelation ( Builder $query, Builder $parent, array | mixed $columns = ['*'] ) : Builder Add the constraints for a relationship query on the same table.
getResults ( ) : mixed Get the results of the relationship.
initRelation ( array $models, string $relation ) : array Initialize the relation on a set of models.
match ( array $models, Illuminate\Database\Eloquent\Collection $results, string $relation ) : array Match the eagerly loaded results to their parents.
update ( array $attributes ) : mixed Update the parent model on the relationship.

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

Метод Описание
getEagerModelKeys ( array $models ) : array Gather the keys from an array of related models.

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

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

Create a new belongs to relationship instance.
public __construct ( Builder $query, Model $parent, string $foreignKey, string $otherKey, string $relation ) : void
$query Illuminate\Database\Eloquent\Builder
$parent Illuminate\Database\Eloquent\Model
$foreignKey string
$otherKey string
$relation string
Результат void

addConstraints() публичный метод

Set the base constraints on the relation query.
public addConstraints ( ) : void
Результат void

addEagerConstraints() публичный метод

Set the constraints for an eager load of the relation.
public addEagerConstraints ( array $models ) : void
$models array
Результат void

associate() публичный метод

Associate the model instance to the given parent.
public associate ( Model | integer $model ) : Model
$model Illuminate\Database\Eloquent\Model | integer
Результат Illuminate\Database\Eloquent\Model

dissociate() публичный метод

Dissociate previously associated model from the given parent.
public dissociate ( ) : Model
Результат Illuminate\Database\Eloquent\Model

getEagerModelKeys() защищенный метод

Gather the keys from an array of related models.
protected getEagerModelKeys ( array $models ) : array
$models array
Результат array

getForeignKey() публичный метод

Get the foreign key of the relationship.
public getForeignKey ( ) : string
Результат string

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

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

getQualifiedForeignKey() публичный метод

Get the fully qualified foreign key of the relationship.
public getQualifiedForeignKey ( ) : string
Результат string

getQualifiedOtherKeyName() публичный метод

Get the fully qualified associated key of the relationship.
public getQualifiedOtherKeyName ( ) : string
Результат string

getRelation() публичный метод

Get the name of the relationship.
public getRelation ( ) : string
Результат string

getRelationCountHash() публичный метод

Get a relationship join table hash.
public getRelationCountHash ( ) : string
Результат string

getRelationQuery() публичный метод

Add the constraints for a relationship query.
public getRelationQuery ( Builder $query, Builder $parent, array | mixed $columns = ['*'] ) : Builder
$query Illuminate\Database\Eloquent\Builder
$parent Illuminate\Database\Eloquent\Builder
$columns array | mixed
Результат Illuminate\Database\Eloquent\Builder

getRelationQueryForSelfRelation() публичный метод

Add the constraints for a relationship query on the same table.
public getRelationQueryForSelfRelation ( Builder $query, Builder $parent, array | mixed $columns = ['*'] ) : Builder
$query Illuminate\Database\Eloquent\Builder
$parent Illuminate\Database\Eloquent\Builder
$columns array | mixed
Результат Illuminate\Database\Eloquent\Builder

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 ) : array
$models array
$relation string
Результат array

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

Match the eagerly loaded results to their parents.
public match ( array $models, Illuminate\Database\Eloquent\Collection $results, string $relation ) : array
$models array
$results Illuminate\Database\Eloquent\Collection
$relation string
Результат array

update() публичный метод

Update the parent model on the relationship.
public update ( array $attributes ) : mixed
$attributes array
Результат mixed

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

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

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

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

The associated key on the parent model.
protected string $otherKey
Результат string

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

The name of the relationship.
protected string $relation
Результат string

$selfJoinCount защищенное статическое свойство

The count of self joins.
protected static int $selfJoinCount
Результат integer