Undefiend Property in One to Many Relationship #639
-
Beta Was this translation helpful? Give feedback.
Answered by
JeremieConstant
Aug 21, 2023
Replies: 1 comment 2 replies
-
@JeremieConstant if the Eloquent relationships are defined, Backpack should pick them up just fine. So I suspect there's some misconfiguration here, either in the relationships in the Model, or in the CrudController regarding the fields/columns. What does your |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@tabacitu thanks for following up on my topic. I could find a solution to the problem, which i wanted to share, since it seems to be a backpack related issue.
In my "Event" model the field "course" holds the uid of the related Course model.
I noticed that when i rename the "course" function which resolves the relationship to something else, backpack no longer throws and error and correctly resolved the relation.
Before:
public function course(): BelongsTo { return $this->belongsTo(Course::class, 'course', 'uid'); }
After:
public function coursefoo(): BelongsTo { return $this->belongsTo(Course::class, 'course', 'uid'); }
I assume the function to resolve the relation to a model must not h…