BelongsToMany: adds hyphen between 2 word model like this App\Course::long-features() #3324
Unanswered
rbijkercom
asked this question in
Q&A
Replies: 2 comments 7 replies
-
Using below should solve your issue: BelongsToMany::make('LongFeatures', 'longFeatures') |
Beta Was this translation helpful? Give feedback.
2 replies
-
Tested again by reproducing above scenario on fresh Laravel Nova and unable to replicate. See nova-issues/issue-3324@d87a914 |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description:
I have a model "Course" with a relationship
BelongsToMany::make('LongFeatures')
When attaching a new LongFeature Nova gives an error
Call to undefined method App\Course::long-features()
but is should be looking for
App\Course::longFeatures()
instead.How do I get Nova to attach this longFeature correctly?
Detailed steps to reproduce the issue on a fresh Nova installation:
Model Course.php has this relationship
As a Nova resource I have Nova/Course.php with this relationship:
BelongsToMany::make('LongFeatures')
In Nova, on the Course resource view, I can see the related longFeatures correctly.
But when trying to attach a new longFeature I get this error:
Call to undefined method App\Course::long-features()
I get the error on the page where it is trying to attach the model:
/nova/resources/courses/1/attach/long-features?viaRelationship=longfeatures&polymorphic=0
So it is putting a hyphen between the 2 words. It's looking for
App\Course::long-features()
, but it should lookApp\Course::longFeatures()
I've already tried this without luck:
BelongsToMany::make('LongFeatures', 'longFeatures', 'App\Nova\LongFeature'),
Beta Was this translation helpful? Give feedback.
All reactions