trait Relationship (View source)

Methods

string
getKey()

Get the table key

belongsTo(string $related, string|null $foreign_key = null, string|null $local_key = null)

The has one relative

belongsToMany(string $related, string|null $primary_key = null, string|null $foreign_key = null)

The belongs to many relative

hasMany(string $related, string|null $primary_key = null, string|null $foreign_key = null)

The has many relative

hasOne(string $related, string|null $primary_key = null, string|null $foreign_key = null)

The has one relative

Details

abstract string getKey()

Get the table key

Return Value

string

BelongsTo belongsTo(string $related, string|null $foreign_key = null, string|null $local_key = null)

The has one relative

Parameters

string $related
string|null $foreign_key
string|null $local_key

Return Value

BelongsTo

BelongsToMany belongsToMany(string $related, string|null $primary_key = null, string|null $foreign_key = null)

The belongs to many relative

Parameters

string $related
string|null $primary_key
string|null $foreign_key

Return Value

BelongsToMany

HasMany hasMany(string $related, string|null $primary_key = null, string|null $foreign_key = null)

The has many relative

Parameters

string $related
string|null $primary_key
string|null $foreign_key

Return Value

HasMany

HasOne hasOne(string $related, string|null $primary_key = null, string|null $foreign_key = null)

The has one relative

Parameters

string $related
string|null $primary_key
string|null $foreign_key

Return Value

HasOne