SarkariResultess QA Bank

How is a One-to-Many Relationship Defined in Laravel?

Laravel Published 26 Sept 2026 0 Views Verified
Laravel Eloquent represents relationships such as one-to-many using relationship methods. For example, a Category model can define hasMany(Question::class) while the Question model can define belongsTo(Category::class).
Sarkari Result QA Bank
Editorially reviewed exam information

Answer & Explanation

4 Answers
Verified Correct Answer

A. hasMany and belongsTo

A one-to-many relationship is commonly represented using hasMany on the parent model and belongsTo on the child model.
Additional Explanation
For example, one category can have many questions, while each question belongs to one category. The foreign key normally exists on the child table.
Verified

B. only hasOne

hasOne represents a one-to-one relationship, not a normal one-to-many parent relationship.
Additional Explanation
It is used when one model is related to one other model.
Verified

C. only belongsToMany

belongsToMany is generally used for many-to-many relationships.
Additional Explanation
It normally works with an intermediate pivot table.
Verified

D. only morphOne

morphOne is used for a polymorphic one-to-one relationship.
Additional Explanation
It is not the usual definition of a standard one-to-many relationship.