BelongsTo and hasOne appear when using ORM tp5 model has represented one relationship, but the two are not the same. The following examples illustrate the difference between the two:
First, there Field user id name password field
then has user_address table id user_id city field
when associated user_address table used in the User model the hasOne , the user table since no foreign key tables associated with two
when used in the model UserAddress user table associated with a belongsTo , since user_address table has two associated foreign key tables user_id
belongsTo, hasOne, hasMany, represent the first three parameters ( 'model name to be associated', 'two models associated foreign key', 'associated with the foreign key in another table primary key id id')