awcodes / filament-curator

A media picker plugin for Filament Panels.
MIT License
324 stars 86 forks source link

Fix relation names #428

Closed Rattone closed 8 months ago

Rattone commented 8 months ago

I tried the same relation "featuredImage" on a filament installation and by copying and pasting the code I get the Call to undefined method App\Models\Post::featured_image() error in a resource edit page with featured_image_id = null.

Rattone commented 8 months ago

The error does not occur if featured_image_id is set, I don't understand if it is a filament or laravel bug but I would correct the documentation for those who have had this error like me

Rattone commented 8 months ago

I would also suggest reversing the order of the changes to be made to Form component and Model, in my opinion it is more logical to do Model relation firsts (I might already have it) and then add the form component..

awcodes commented 8 months ago

The Readme is just an example for defining a relationship. Standard Laravel relationship conventions still apply, so, there is no right or wrong way to show in the readme. It is still up to the developer to have an understanding of what and how to use the relationships set up in their own apps.

Thank you, though. 😀