When using the ORM of the tp5 model, belongsTo and hasOne both represent a one-to-one relationship, but the two are not the same. The following example illustrates the difference between the two:
first there is the user table field id name password field
and then the user_address table id user_id city field
Use hasOne when associating the user_address table in the User model, because there is no foreign key that associates the two tables in the user table
Use belongsTo when associating the user table in the UserAddress model, because there is a foreign key user_id that associates the two tables in the user_address table