Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #283
    dan
    Participant

    What’s the difference between hasOne and hasMany relationship in Laravel?

    #284

    The difference is quite obvious. hasOne maps one model to another model. hasMany maps one model to many models.

    The obvious though and most are not aware though that hasOne returns an instance of a model such as App/Models/Car while hasMany returns an eloquent collection of Models Illuminate\Database\Eloquent\Collection

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.