vemto-issues icon indicating copy to clipboard operation
vemto-issues copied to clipboard

Filament plugin doesn't change crud

Open num3r06 opened this issue 1 year ago • 14 comments

Describe the bug Hi, i use filament plugin and at the first start all work fine. But i try to modify a crud adding a relationship field. In the crud app all works in filament dashboard the new field not appears. I try to duplicate project, delete and regenerate folder, uninstall e reinstall plugin, deselect and reselect the crud in the plugin panel but seems to be cached an older version

To Reproduce Steps to reproduce the behavior:

  1. In the new project add a crud app and install filament plugin
  2. Generate and run
  3. modifiy crud app adding a relation in substitution of a field
  4. regenerate all
  5. the changes not appear

Expected behavior The changes in crud app must been reflected in filament admin panel Desktop (please complete the following information):

  • win11 with laragon
  • Chrome
  • Last version

num3r06 avatar Apr 28 '23 22:04 num3r06

@num3r06 thank you for reporting. I'm adding @nicollassilva to this conversation to check what is happening

TiagoSilvaPereira avatar May 02 '23 13:05 TiagoSilvaPereira

Hi @num3r06 , I hope you are well.

I followed your steps but I couldn't reproduce locally. My steps were as follows:

I created a Post model, and a field called post_category_id. Soon after, I created the CRUDs, installed the Filament and generated the files.

After that, I created a model called PostCategory and created a relationship with posts, replacing the post_category_id field to make a relationship field. I went back to the Post CRUD, added a select for the post_category_id relationship, and to the Filament plugin configuration, I filled it in to generate the relationship.

It worked normally, can you tell me if the steps are right? And if you want, leave your .vemto with a more detailed explanation of the problem.

Thanks.

nicollassilva avatar May 02 '23 18:05 nicollassilva

Hi, The correct workflow is:

  • Create a post model with category field
  • Generate and run project
  • Adding a category model
  • adding a relationship between two models Deleting category field in post model and add post_category_id
  • Regenerate and rerun project

num3r06 avatar May 04 '23 12:05 num3r06

@nicollassilva

TiagoSilvaPereira avatar May 04 '23 13:05 TiagoSilvaPereira

In a new test I realized that even in the regeneration of the project the models are not updated with the correct relationships outside filament

num3r06 avatar May 04 '23 14:05 num3r06

@num3r06 did you filled the options to generate the relationships in the Plugin page?

image

TiagoSilvaPereira avatar May 05 '23 14:05 TiagoSilvaPereira

Noticing same issues. The resources are not updating after changing / adding fields in Vemto using the Filament plugin. It's almost as though the initial generation output is cached and not updating on future generation.

flashmediasolutions avatar May 15 '23 23:05 flashmediasolutions

@flashmediasolutions could you please record a video showing the issue ?

TiagoSilvaPereira avatar May 16 '23 14:05 TiagoSilvaPereira

The system seems to update everything (that I have checked) except the Resource.php file. So anything after the initial creation doesn't update.

https://github.com/TiagoSilvaPereira/vemto-issues/assets/12239388/c34aaac6-eac7-4901-a78e-bd7c65c520bd

flashmediasolutions avatar May 16 '23 16:05 flashmediasolutions

@flashmediasolutions The Filament plugin is based on CRUD applications, not in the model. You need to add the input to the CRUD after creating a new column

TiagoSilvaPereira avatar May 16 '23 16:05 TiagoSilvaPereira

I assumed that if I added a column to Vemto that it would update all the corresponding files, like it does with the Nova plugin. Without that dynamic file update, it makes the Filament / Vemto plugin useless after initial generation.

flashmediasolutions avatar May 16 '23 16:05 flashmediasolutions

@flashmediasolutions I'm not sure why you think it is useless. As I said, If you add the input to the CRUD after adding the column, the plugin will generate it without problems (you can always edit CRUD after first generating them). It just takes another step: add the column, then add the CRUD input (it is because the Filament plugins use the CRUD settings to guess what type of input it needs to generate).

Anyway, for Vemto 2, I'll take another approach for the Filament plugin (not attached to CRUD applications)

TiagoSilvaPereira avatar May 16 '23 17:05 TiagoSilvaPereira

It looks like if I delete the CRUD and re-add it back any new fields now generate correctly.

So I believe there is still a bug, but deleting and re-adding the CRUD is a work around.

Thanks

flashmediasolutions avatar May 16 '23 17:05 flashmediasolutions

@flashmediasolutions It is not necessary to delete a CRUD and generate it again. You can open the CRUD editor and add an input for the new Model column:

image

TiagoSilvaPereira avatar May 16 '23 19:05 TiagoSilvaPereira