You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was having a look at the relation between Inventory and Metric models.
I noticed this:
public function metric()
{
return $this->hasOne('Stevebauman\Inventory\Models\Metric', 'id', 'metric_id');
}
And in the Metric class:
public function items()
{
return $this->hasMany('Stevebauman\Inventory\Models\Inventory', 'metric_id', 'id');
}
AFAIK, reading the docs, the hasOne relation should be used for one-to-one relations, the inverse of hasMany being belongsTo. Am I wrong? Did you have something else in mind when using hasOne ?
The text was updated successfully, but these errors were encountered:
I was having a look at the relation between Inventory and Metric models.
I noticed this:
And in the Metric class:
AFAIK, reading the docs, the hasOne relation should be used for one-to-one relations, the inverse of
hasMany
beingbelongsTo
. Am I wrong? Did you have something else in mind when usinghasOne
?The text was updated successfully, but these errors were encountered: