AthroHiro
$set Not working when using with a relationship
I have an Organisation Resource, an Organisation has one Location which is a mophOne relationship. With the code below I make it possible for the user to input just the postal_code and the number, I have an API which fetches the address based on those two fields. When the result get's back I fill the other fields with the
$set()
function as you can see. All of this works fine, the fields do get populated with the fetched data. But as soon as I press the save button on my resource, only the postal_code
and the number
get updated the other values reset to their original value before the $set happened ending up with an incorrect record in the database with the updated postal_code
and number
and the outdated street
, city
, province
etc.
Why isn't this working? How do I make this work?
10 replies
delete index
The documentation says that we can delete any resource page we want (https://filamentphp.com/docs/3.x/panels/resources/getting-started#deleting-resource-pages), however when I delete the index page of my CompanyResource I get the following error:
I initially made a custom page but very soon I noticed some major disadvantages, f.e I downloaded the Apex Chart plugin and when initliazing a new chart the CLI asks for a resource, but when using a custom page you don't have one. So I decided to use a resource, the only page a logged in user is allowed to see is the edit page. So I wanted to disable the index and view pages. But than I run into the problem I mentioned before.
What is the best way to achieve this scenario: a custom panel for companies, a company can login and edit just their own company fields and also see and edit their employees which do have a table but must also be addable/edditable in the edit company view using a relationmanager.
13 replies