I have just started using Laravel. I have not used Laravel Eloquent before. So I am directly using it on graph database using NeoEloquent. I know I can create relationship using hasMany() and attach() methods. But I want to create relationship only once. Has anybody used NeoEloquent for creating Unique Relationship.
Asked
Active
Viewed 239 times
1 Answers
0
You may use the hasOne()
relationship instead of hasMany()
which will ensure that only one relationship of the specified type exists for the model.

mulkave
- 831
- 1
- 10
- 22