PHP 클래스 Illuminate\Database\Eloquent\Relations\BelongsTo

상속: extends Illuminate\Database\Eloquent\Relations\Relation
파일 보기 프로젝트 열기: illuminate/database 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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