Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php artisan make:fileament-resource generate wrong code if a column is an enum #12717

Open
rabol opened this issue May 9, 2024 · 4 comments
Open
Labels
bug Something isn't working low priority unconfirmed
Milestone

Comments

@rabol
Copy link

rabol commented May 9, 2024

Package

filament/filament

Package Version

v3.2.76

Laravel Version

v11.7.0

Livewire Version

No response

PHP Version

v8.3.6

Problem description

If you have a column on your model that is of type enum then the generated code by php artisan make:filament-resource UserResource -G is not correct.

this is generated

Tables\Columns\TextColumn::make('user_level')
                    ->numeric()
                    ->sortable(),

Expected behavior

That the code generated is valid and working.

Steps to reproduce

Use the repo, login select the users

Reproduction repository

https://github.com/rabol/filament-bug

Relevant log output

No response

@rabol rabol added bug Something isn't working low priority unconfirmed labels May 9, 2024
@danharrin danharrin added this to the v3 milestone May 10, 2024
@giacomomasseron
Copy link

I cloned your repo but this is the migration:

$table->integer('user_level')->default(0);

it's not an enum

@rabol
Copy link
Author

rabol commented May 12, 2024

On the model it’s casted to a enum, how would you otherwise do it?

it works in all other parts of the app

@giacomomasseron
Copy link

You could use the enum function of a migration.

IMHO seems more an enhancement, instead of a bug.

Filament gets database schema to create the list and the form. It does not check the laravel casts.

@rabol
Copy link
Author

rabol commented May 14, 2024

a boolean work even if it stored in the db as an int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority unconfirmed
Projects
Status: Todo
Development

No branches or pull requests

3 participants