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

bug in php artisan resource-file:from-database, wrong json field data type validation #190

Open
larg000 opened this issue Mar 12, 2023 · 0 comments
Milestone

Comments

@larg000
Copy link

larg000 commented Mar 12, 2023

Environment:

  • Laravel-Code-Generator Version: 2.4.9
  • Laravel Version: 10

Description:

bug in ressource generator command php artisan resource-file:from-database

dont convert correctly some field in ressource .json file

after many test, seems can't have a string field with the word 'age' inside like image
otherwise it is convert from string to numeric

CREATE TABLE IF NOT EXISTS test (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
image varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (id)

Steps/Commands To Reproduce:

php artisan resource-file:from-database Test

Content Of The Resource-File:

{
            "name": "image",
             ...
            "html-value": null,
            "validation": "nullable|numeric", // instead of "nullable|string|min:0|max:255"
            ...
}

modify image to imaga or imago
php artisan resource-file:from-database Test
it works

{
            "name": "imago",
             ...
            "html-type": "text",
            "css-class": "",
            "options": {},
            "html-value": null,
            "validation": "nullable|string|min:0|max:255",
            ...
}
@MikeAlhayek MikeAlhayek added this to the 3.x milestone Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants