BelongsToMany Relationship Cast Problem on Edit Record
Hi, this is my first time asking the question on this forum. So i hope i will able to provide all the details that are required.
Let me first explain what issue i am having. I have a relationship-manager UsersRelationManager for ProjectResource
The data displayed on table for Special CPI is properly casted using MoneyCast. (Storing 650 in database and displaying $6.50 on table)
But when i click on edit record Special CPI value is 650 instead of 6.50.
The Cast is working properly on the ProjectResource everywhere. Only giving error on relationship.
I hope i am able to explain it properly, let me know if you need more details. And thank you in advance 🙂 Attached the 2nd image (for edit Record) in next post.
I hope i am able to explain it properly, let me know if you need more details. And thank you in advance 🙂 Attached the 2nd image (for edit Record) in next post.
3 Replies
MoneyCast code
So i have 3 tables in my app.
Project Table
User Table
ProjectUser Pivot Table
Project Model has Cast and BelongsToMany Relationship
User Model has BelongsToMany Relationship
ProjectUser Model with Casts and other table related data
Than i have UsersRelationManager for ProjectResource
That's all.
I am really sorry for sending more than few messages, discord limits the max characters
Hi, @CodingAuthority
have you figured out how to solve this problem?
The most interesting thing is that in my case, when writing, cast works, but when reading for editing it does not =/
here not a solution, but an interesting workaround https://www.youtube.com/watch?v=0vhAfwr1WRk
Filament Daily
YouTube
Filament Macros: Add Methods To Columns and Inputs
Example of a method to be added to your TextInput, TextColumn and similar components.
Source: https://github.com/andrewdwallo/erpsaas/blob/2.x/app/Providers/AppServiceProvider.php
More Filament examples on our website: https://filamentexamples.com