Relationships

Eloquent relationships describe the links between models: hasMany, belongsTo, hasOne, belongsToMany. Once declared, the relationship is used like a property, for example $article->commentaires. It relies on foreign keys following naming conventions.

Example

public function commentaires()
{
  return $this->hasMany(Commentaire::class);
}

Related concepts

The whole glossary