MWZ

MINDWAREZONE

beginnerLaravel

What is a one-to-one relationship?

Answer

Clear, interview-ready explanation

A one-to-one relationship means one record in a model is associated with at most one record in another model. For example, a User may have one Profile, and the profiles table commonly holds a user_id foreign key.

In Eloquent, the owning side commonly defines a hasOne relationship and the related model defines the inverse belongsTo relationship. This relationship is appropriate when data belongs conceptually to one parent but is separated for organization, optionality, security, or a different lifecycle.