CrestApps / laravel-code-generator

An efficient Laravel code generator, saving time by automating the creation of resources such as views, controllers, routes, migrations, languages, and form-requests. Highly flexible and customizable, it includes a cross-browser compatible template and client-side validation for application modernization.
https://laravel-code-generator.crestapps.com
MIT License
737 stars 157 forks source link

Validations accepting parameters like max, size etc, their parameters gets ignored #162

Open kubre opened 4 years ago

kubre commented 4 years ago

Environment:

Description:

Validation rules accepting parameters like max, size etc, their parameters gets ignored, as ex. if validation rule max:255 is given resource file will only get max as validation rule. though it only affects resource file as if you have max:255 in resource file then generate the rules it will reflect as expected.

Steps/Commands To Reproduce:

php artisan create:scaffold School --fields="id,name:name;validation:required|string|max:200,name:logo;html-type:file;validation:required|image|max:512,name:contact;validation:required|numeric|max:20,name:address;html-type:textarea;validation:required|string|max:500;data-type-params:500,name:prinicipal;validation:required|string|max:100,name:email;html-type:email;required|email|max:100" --with-migration --with-form-request --with-auth

Content Of The Resource-File:

{
    "fields": [{
            "name": "id",
            "labels": "Id",
            "html-type": "text",
            "css-class": "",
            "options": {},
            "html-value": null,
            "validation": "",
            "is-on-index": false,
            "is-on-show": false,
            "is-on-form": false,
            "data-type": "int",
            "data-type-params": [],
            "data-value": null,
            "is-index": false,
            "is-unique": false,
            "is-primary": true,
            "comment": null,
            "is-nullable": false,
            "is-header": false,
            "is-unsigned": true,
            "is-auto-increment": true,
            "is-inline-options": false,
            "is-date": false,
            "date-format": "",
            "cast-as": "",
            "placeholder": "Enter id here...",
            "delimiter": "; ",
            "range": [],
            "foreign-relation": null,
            "foreign-constraint": null,
            "on-store": null,
            "on-update": null,
            "api-key": "id",
            "is-api-visible": true,
            "api-description": "The id of the model."
        },
        {
            "name": "name",
            "labels": "Name",
            "html-type": "text",
            "css-class": "",
            "options": {},
            "html-value": null,
            "validation": "required|string|max|min:1",
            "is-on-index": true,
            "is-on-show": true,
            "is-on-form": true,
            "data-type": "string",
            "data-type-params": [
                255
            ],
            "data-value": null,
            "is-index": false,
            "is-unique": false,
            "is-primary": false,
            "comment": null,
            "is-nullable": false,
            "is-header": true,
            "is-unsigned": false,
            "is-auto-increment": false,
            "is-inline-options": false,
            "is-date": false,
            "date-format": "",
            "cast-as": "",
            "placeholder": "Enter name here...",
            "delimiter": "; ",
            "range": [],
            "foreign-relation": null,
            "foreign-constraint": null,
            "on-store": null,
            "on-update": null,
            "api-key": "name",
            "is-api-visible": true,
            "api-description": "The name of the model."
        },
        {
            "name": "logo",
            "labels": "Logo",
            "html-type": "file",
            "css-class": "",
            "options": {},
            "html-value": null,
            "validation": "required|image|max|file",
            "is-on-index": true,
            "is-on-show": true,
            "is-on-form": true,
            "data-type": "string",
            "data-type-params": [],
            "data-value": null,
            "is-index": false,
            "is-unique": false,
            "is-primary": false,
            "comment": null,
            "is-nullable": false,
            "is-header": false,
            "is-unsigned": false,
            "is-auto-increment": false,
            "is-inline-options": false,
            "is-date": false,
            "date-format": "",
            "cast-as": "",
            "placeholder": {},
            "delimiter": "; ",
            "range": [],
            "foreign-relation": null,
            "foreign-constraint": null,
            "on-store": null,
            "on-update": null,
            "api-key": "logo",
            "is-api-visible": true,
            "api-description": "The logo of the model."
        },
        {
            "name": "contact",
            "labels": "Contact",
            "html-type": "text",
            "css-class": "",
            "options": {},
            "html-value": null,
            "validation": "required|numeric|max|string|min:1",
            "is-on-index": true,
            "is-on-show": true,
            "is-on-form": true,
            "data-type": "string",
            "data-type-params": [],
            "data-value": null,
            "is-index": false,
            "is-unique": false,
            "is-primary": false,
            "comment": null,
            "is-nullable": false,
            "is-header": false,
            "is-unsigned": false,
            "is-auto-increment": false,
            "is-inline-options": false,
            "is-date": false,
            "date-format": "",
            "cast-as": "",
            "placeholder": "Enter contact here...",
            "delimiter": "; ",
            "range": [],
            "foreign-relation": null,
            "foreign-constraint": null,
            "on-store": null,
            "on-update": null,
            "api-key": "contact",
            "is-api-visible": true,
            "api-description": "The contact of the model."
        },
        {
            "name": "address",
            "labels": "Address",
            "html-type": "textarea",
            "css-class": "",
            "options": {},
            "html-value": null,
            "validation": "required|string|max|min:1",
            "is-on-index": true,
            "is-on-show": true,
            "is-on-form": true,
            "data-type": "string",
            "data-type-params": [
                500
            ],
            "data-value": null,
            "is-index": false,
            "is-unique": false,
            "is-primary": false,
            "comment": null,
            "is-nullable": false,
            "is-header": false,
            "is-unsigned": false,
            "is-auto-increment": false,
            "is-inline-options": false,
            "is-date": false,
            "date-format": "",
            "cast-as": "",
            "placeholder": {},
            "delimiter": "; ",
            "range": [],
            "foreign-relation": null,
            "foreign-constraint": null,
            "on-store": null,
            "on-update": null,
            "api-key": "address",
            "is-api-visible": true,
            "api-description": "The address of the model."
        },
        {
            "name": "prinicipal",
            "labels": "Prinicipal",
            "html-type": "text",
            "css-class": "",
            "options": {},
            "html-value": null,
            "validation": "required|string|max|min:1",
            "is-on-index": true,
            "is-on-show": true,
            "is-on-form": true,
            "data-type": "string",
            "data-type-params": [],
            "data-value": null,
            "is-index": false,
            "is-unique": false,
            "is-primary": false,
            "comment": null,
            "is-nullable": false,
            "is-header": false,
            "is-unsigned": false,
            "is-auto-increment": false,
            "is-inline-options": false,
            "is-date": false,
            "date-format": "",
            "cast-as": "",
            "placeholder": "Enter prinicipal here...",
            "delimiter": "; ",
            "range": [],
            "foreign-relation": null,
            "foreign-constraint": null,
            "on-store": null,
            "on-update": null,
            "api-key": "prinicipal",
            "is-api-visible": true,
            "api-description": "The prinicipal of the model."
        },
        {
            "name": "email",
            "labels": "Email",
            "html-type": "email",
            "css-class": "",
            "options": {},
            "html-value": null,
            "validation": "",
            "is-on-index": true,
            "is-on-show": true,
            "is-on-form": true,
            "data-type": "string",
            "data-type-params": [],
            "data-value": null,
            "is-index": false,
            "is-unique": false,
            "is-primary": false,
            "comment": null,
            "is-nullable": true,
            "is-header": false,
            "is-unsigned": false,
            "is-auto-increment": false,
            "is-inline-options": false,
            "is-date": false,
            "date-format": "",
            "cast-as": "",
            "placeholder": "Enter email here...",
            "delimiter": "; ",
            "range": [],
            "foreign-relation": null,
            "foreign-constraint": null,
            "on-store": null,
            "on-update": null,
            "api-key": "email",
            "is-api-visible": true,
            "api-description": "The email of the model."
        }
    ],
    "relations": [],
    "indexes": [],
    "auto-manage-created-and-updated-at": true,
    "table-name": null,
    "protection": {
        "is-model-protected": false,
        "is-controller-protected": false,
        "is-api-resource-protected": false,
        "is-api-resource-collection-protected": false,
        "is-api-documentation-protected": false,
        "is-api-documentation-controller-protected": false,
        "is-form-request-protected": false,
        "is-languages-protected": false,
        "is-form-view-protected": false,
        "is-index-view-protected": false,
        "is-create-view-protected": false,
        "is-edit-view-protected": false,
        "is-show-view-protected": false
    },
    "api-documentation": {
        "access_token_with_bearer": "The access token prefixed with the \"Bearer \" key word.",
        "index_route_description": "Retrieve existing schools.",
        "index_route_response_description": "The API's response will be JSON based data. The JSON object will be structured as follow",
        "the_key_is_the_model_property_and_the_value_is_the_model_value": "The array's key is the school property name where the value is the assigned value to the retrieved school.",
        "link_to_retrieve_first_page": "Link to retrieve first page.",
        "link_to_retrieve_last_page": "Link to retrieve last page.",
        "link_to_retrieve_previous_page": "Link to retrieve previous page.",
        "link_to_retrieve_next_page": "Link to retrieve next page.",
        "the_number_of_current_page": "The number of current page.",
        "the_index_of_the_first_retrieved_item": "The index of first retrieved school.",
        "the_number_of_the_last_page": "The number of the last page.",
        "the_base_link_to_the_resource": "The base link to the api resource.",
        "the_number_of_models_per_page": "The number of schools per page.",
        "the_index_of_the_last_retrieved_item": "The index of last retrieved school.",
        "the_total_of_available_pages": "The total of the available pages.",
        "store_route_description": "Create new school.",
        "store_route_response_description": "The API's response will be JSON based data. The JSON object will be structured as follow",
        "update_route_description": "Update existsing school.",
        "update_route_response_description": "The API's response will be JSON based data. The JSON object will be structured as follow",
        "show_route_description": "Retrieve existsing school.",
        "show_route_response_description": "The API's response will be JSON based data. The JSON object will be structured as follow",
        "the_id_of_model_to_retrieve": "The unique id of the school to retrieve",
        "destroy_route_description": "Delete existsing school.",
        "destroy_route_response_description": "The API's response will be JSON based data. The JSON object will be structured as follow",
        "the_id_of_model_to_delete": "The id of the school to delete.",
        "general_description": "Allows you to list, create, edit, show and delete schools.",
        "indicate_whether_the_request_was_successful_or_not": "Indicate whether the request was successful or not.",
        "the_id_of_the_model": "The id of the school.",
        "this_parameter_must_be_present_in_the_request": "This parameter must be present in the request.",
        "the_request_failed_validation": "The request failed validation.",
        "list_of_the_invalid_errors": "List of the invalid errors.",
        "the_requested_model_does_not_exists": "The requested school does not exists.",
        "the_user_does_not_have_permission_to_access_the_requested_resource": "User does not have permission to access the requested resource."
    }
}
weppami commented 4 years ago

Same setup, same problem

Roham0010 commented 10 months ago

I wonder why this is not fixed :thinking: