Declaring hasMany() implies belongsTo() declaration on the other side?


#1

In a model A I declared a hasMany() relationship with a model B.

Does this imply that I must declare a belongsTo() relationship in B ?


#2

In short, no. It’s not mandatory but makes logical sense.


#3

Hey @begueradj! :wave:

No need to define the relation on both models if you will use it only one-way.

There’s a note on this in the documentation.