Skip to content

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

@larg000

Description

@larg000

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",
            ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions