diff --git a/docs/docs/available-commands.md b/docs/docs/available-commands.md
index 5b420d5..5f691e5 100644
--- a/docs/docs/available-commands.md
+++ b/docs/docs/available-commands.md
@@ -196,7 +196,7 @@ All examples below assumes that you already created a [resource-file](./resource
| ----------- | ----------- | ----------- |
| --layout-filename | The name of the layout file to be used. | `app` (i.e, creates `app.blade.php`) |
| --layout-directory | The directory to create the layout under. | `layouts` |
- | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
+ | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
| --force | This option will override the layout if one already exists. | |
:::
@@ -218,29 +218,29 @@ All examples below assumes that you already created a [resource-file](./resource
| Option | Description | Default |
| ----------- | ----------- | ----------- |
- | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
- | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
- | --controller-extends | Specify which class should the controller extends. Note: the default value is can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `default-controller` which means use the settings from the configurations by default `Http\Controllers\Controller` |
- | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
- | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
- | --models-per-page | How many models to show per page on the index view. | `25` |
- | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
- | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
- | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
- | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
- | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
- | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
- | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
- | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
- | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
- | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
- | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
- | --engine-name | A specific engine name for the database's table can be provided here. | |
- | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
- | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
- | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
- | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
- | --fields | [Described below](#fields) | |
+ | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
+ | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
+ | --controller-extends | Specify which class should the controller extends. Note: the default value is can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `default-controller` which means use the settings from the configurations by default `Http\Controllers\Controller` |
+ | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
+ | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
+ | --models-per-page | How many models to show per page on the index view. | `25` |
+ | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
+ | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
+ | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
+ | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
+ | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
+ | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
+ | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
+ | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
+ | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
+ | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
+ | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
+ | --engine-name | A specific engine name for the database's table can be provided here. | |
+ | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
+ | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
+ | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
+ | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
+ | --fields | [Described here](./resource-file#fields) | |
| --template-name | [Described above](#template-name) | |
| --force | This option will override the layout if one already exists. | |
:::
@@ -262,7 +262,7 @@ When using `resource-file:create`, `resource-file:from-database` or `resource-fi
| --with-auth | [Described above](#with-auth) |
| --models-per-page | [Described above](#models-per-page) |
| --with-form-request | [Described above](#with-form-request) |
- | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
+ | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
| --form-request-directory | [Described above](#form-request-directory) |
| --table-exists | [Described above](#table-exists) |
| --translation-for | [Described above](#translation-for) |
@@ -309,9 +309,9 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| --form-request-directory | [Described above](#form-request-directory) |
| --model-directory | [Described above](#model-directory) |
| --views-directory | [Described above](#views-directory) |
- | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
- | --without-model | Allow you to create all the resources excluding the model. |
- | --without-views | Allow you to create all the resources excluding the views. |
+ | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
+ | --without-model | Allow you to create all the resources excluding the model. |
+ | --without-views | Allow you to create all the resources excluding the views. |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
:::
@@ -390,8 +390,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| ----------- | ----------- | ----------- |
| --resource-file | [Described above](#resource-file) |
| --routes-prefix | [Described above](#routes-prefix) |
- | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
- | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
+ | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
+ | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
| --views-directory | [Described above](#views-directory) |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
diff --git a/docs/docs/resource-file.md b/docs/docs/resource-file.md
index 52d8448..1de5a7d 100644
--- a/docs/docs/resource-file.md
+++ b/docs/docs/resource-file.md
@@ -31,10 +31,10 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| Option | Description |
| ----------- | ----------- |
- | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
- | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
- | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
- | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
+ | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
+ | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
+ | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
+ | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
| --translation-for | [Described above](#translation-for) |
| --force | This option will override any file that already exist. |
:::
@@ -152,7 +152,7 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| validation | You can pass any valid Laravel validation rule. The rules should be separated by bar `\|`.
For example: `required\|string\|min:2\|max:255`
Start with Laravel 5.5, you can define custom validation rules and pass them as well. For example, to use a custom validation rule called Uppercase in addition to the required rule, you can pass this string required|new Uppercase.
To learn more about the valid options please visit [Laravel documentation](https://laravel.com/docs/master/validation#available-validation-rules).
When the rule `required` is not used, the field in the migration file will automatically become nullable. |
| html-type | Default value: `text`. A valid property will be one of the following options
`text`, `textarea`, `password`,`email`,`checkbox`,`radio`,`number`,`select`,`hidden`,`file`,`selectRange`,`selectMonth`, or `multipleSelect`.
Note: when using file type, after the file is uploaded to the designated path, the filename is stored in the database by default. For everything to work properly, the data-type must be of some sort of a string type. Or modify the behavior of moveFile method to handle the new file.
By default this process stores the uploaded file in the path defined in config file.
Note: when using checkbox, or multipleSelect, the items are stored in the database as JSON string. Additionally, the items in the index or form views are displayed separated by the value provided in the delimiter property. |
| delimiter | Default value: "; ". When generating a form with checkbox or a select menu that accepts multiple answers, we need either store the results in a foreign model or store the records in a string field. By default, the code generator will convert the multiple options that a user selected into a JSON string before the results are stored using a Eloquent-mutator method.
When the data is presented on the show and/or index views, the options are displayed separated by the value of the delimiter. Of course, you can always change this behavior to fit your needs by removing the accessor and mutator methods in the model and modifying the views accordingly. |
- | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."`` property. Classes that are already set in the views will not be replaced. |
+ | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."` property. Classes that are already set in the views will not be replaced. |
| date-format | Default value: "m/d/Y H:i A". Any field with the type date, time or datetime can be formatted different when it is displayed. You can change the display format using this option. |
| html-value | A default value to set the field to. When using multiple options based html-type like checkbox, multipleSelect you can set this property to array of values to set multiple values by default. Ex, `["Red","Green"]` |
| options | If you used select, checkbox, or radio for the html-type property, this is where you provide the options. Here are some example of the schema.
A simple array: In this option, the value will be the numeric index value of the item in the array.
```"options": ["Prefer not to say","Male","Female"]```.
Using explicit values
```"options": { "": Prefer not to say", "male": "Male","female": "Female"}```.
Using multiple language phrases for each option
```"options": {"en":{"":"Prefer not to say","male":"Male","female":"Female"},"ar":{"":"Prefer not to say in Arabic","male":"Male in Arabic","female":"Female in Arabic"},"fr":{"":"Prefer not to say in French","male":"Male in French","female":"Female in French"}}``` |
@@ -161,8 +161,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| is-on-index | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index view. |
| is-on-form | Default value: `true`. Setting the value to `false` will prevent from adding this field to the form view. |
| is-on-show | Default value: `true`. Setting the value to `false` will prevent from adding this field to the show view. |
- | is-on-views | Default value: `true`. Setting the value to `false`` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
- | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns`` in the configuration file, allow you to list the common field name to automatically set them as header. |
+ | is-on-views | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
+ | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns` in the configuration file, allow you to list the common field name to automatically set them as header. |
#### Database Properties
| Property name | Description |
diff --git a/docs/versioned_docs/version-2.0.0/available-commands.md b/docs/versioned_docs/version-2.0.0/available-commands.md
index 8ea9488..1dfcf63 100644
--- a/docs/versioned_docs/version-2.0.0/available-commands.md
+++ b/docs/versioned_docs/version-2.0.0/available-commands.md
@@ -183,7 +183,7 @@ All examples below assumes that you already created a [resource-file](./resource
| ----------- | ----------- | ----------- |
| --layout-filename | The name of the layout file to be used. | `app` (i.e, creates `app.blade.php`) |
| --layout-directory | The directory to create the layout under. | `layouts` |
- | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
+ | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
| --force | This option will override the layout if one already exists. | |
:::
@@ -205,28 +205,28 @@ All examples below assumes that you already created a [resource-file](./resource
| Option | Description | Default |
| ----------- | ----------- | ----------- |
- | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
- | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
- | --controller-extends | Specify which class should the controller extends. Note: the default value can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `Http\Controllers\Controller` |
- | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
- | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
- | --models-per-page | How many models to show per page on the index view. | `25` |
- | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
- | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
- | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
- | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
- | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
- | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
- | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
- | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
- | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
- | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
- | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
- | --engine-name | A specific engine name for the database's table can be provided here. | |
- | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
- | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
- | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
- | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
+ | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
+ | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
+ | --controller-extends | Specify which class should the controller extends. Note: the default value can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `Http\Controllers\Controller` |
+ | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
+ | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
+ | --models-per-page | How many models to show per page on the index view. | `25` |
+ | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
+ | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
+ | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
+ | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
+ | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
+ | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
+ | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
+ | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
+ | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
+ | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
+ | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
+ | --engine-name | A specific engine name for the database's table can be provided here. | |
+ | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
+ | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
+ | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
+ | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
| --template-name | [Described above](#template-name) | |
| --force | This option will override the layout if one already exists. | |
@@ -249,7 +249,7 @@ When using `resource-file:create`, `resource-file:from-database` or `resource-fi
| --with-auth | [Described above](#with-auth) |
| --models-per-page | [Described above](#models-per-page) |
| --with-form-request | [Described above](#with-form-request) |
- | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
+ | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
| --form-request-directory | [Described above](#form-request-directory) |
| --table-exists | [Described above](#table-exists) |
| --translation-for | [Described above](#translation-for) |
@@ -296,9 +296,9 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| --form-request-directory | [Described above](#form-request-directory) |
| --model-directory | [Described above](#model-directory) |
| --views-directory | [Described above](#views-directory) |
- | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
- | --without-model | Allow you to create all the resources excluding the model. |
- | --without-views | Allow you to create all the resources excluding the views. |
+ | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
+ | --without-model | Allow you to create all the resources excluding the model. |
+ | --without-views | Allow you to create all the resources excluding the views. |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
:::
@@ -374,8 +374,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| ----------- | ----------- | ----------- |
| --resource-file | [Described above](#resource-file) |
| --routes-prefix | [Described above](#routes-prefix) |
- | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
- | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
+ | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
+ | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
| --views-directory | [Described above](#views-directory) |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
diff --git a/docs/versioned_docs/version-2.0.0/intro.md b/docs/versioned_docs/version-2.0.0/intro.md
index 8523b27..38977fc 100644
--- a/docs/versioned_docs/version-2.0.0/intro.md
+++ b/docs/versioned_docs/version-2.0.0/intro.md
@@ -59,4 +59,4 @@ Explore the project's source code on [GitHub](https://github.com/CrestApps/larav
#### (Optional) Using Laravel-Collective
-Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](using-laravel-collective.md)
+Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](./laravel-collective)
diff --git a/docs/versioned_docs/version-2.0.0/laravel-collective.md b/docs/versioned_docs/version-2.0.0/laravel-collective.md
index a19e9aa..6da44cc 100644
--- a/docs/versioned_docs/version-2.0.0/laravel-collective.md
+++ b/docs/versioned_docs/version-2.0.0/laravel-collective.md
@@ -23,7 +23,7 @@ There are two ways to generate views using Laravel-Collective
- Via the package configuration
- > Open the config file of the package /config/codegenerator.php change the value of the key template to default-collective
+ > Open the config file of the package `/config/codegenerator.php` change the value of the key template to default-collective
- Or, via command-line
diff --git a/docs/versioned_docs/version-2.0.0/resource-file.md b/docs/versioned_docs/version-2.0.0/resource-file.md
index 52d8448..1de5a7d 100644
--- a/docs/versioned_docs/version-2.0.0/resource-file.md
+++ b/docs/versioned_docs/version-2.0.0/resource-file.md
@@ -31,10 +31,10 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| Option | Description |
| ----------- | ----------- |
- | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
- | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
- | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
- | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
+ | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
+ | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
+ | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
+ | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
| --translation-for | [Described above](#translation-for) |
| --force | This option will override any file that already exist. |
:::
@@ -152,7 +152,7 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| validation | You can pass any valid Laravel validation rule. The rules should be separated by bar `\|`.
For example: `required\|string\|min:2\|max:255`
Start with Laravel 5.5, you can define custom validation rules and pass them as well. For example, to use a custom validation rule called Uppercase in addition to the required rule, you can pass this string required|new Uppercase.
To learn more about the valid options please visit [Laravel documentation](https://laravel.com/docs/master/validation#available-validation-rules).
When the rule `required` is not used, the field in the migration file will automatically become nullable. |
| html-type | Default value: `text`. A valid property will be one of the following options
`text`, `textarea`, `password`,`email`,`checkbox`,`radio`,`number`,`select`,`hidden`,`file`,`selectRange`,`selectMonth`, or `multipleSelect`.
Note: when using file type, after the file is uploaded to the designated path, the filename is stored in the database by default. For everything to work properly, the data-type must be of some sort of a string type. Or modify the behavior of moveFile method to handle the new file.
By default this process stores the uploaded file in the path defined in config file.
Note: when using checkbox, or multipleSelect, the items are stored in the database as JSON string. Additionally, the items in the index or form views are displayed separated by the value provided in the delimiter property. |
| delimiter | Default value: "; ". When generating a form with checkbox or a select menu that accepts multiple answers, we need either store the results in a foreign model or store the records in a string field. By default, the code generator will convert the multiple options that a user selected into a JSON string before the results are stored using a Eloquent-mutator method.
When the data is presented on the show and/or index views, the options are displayed separated by the value of the delimiter. Of course, you can always change this behavior to fit your needs by removing the accessor and mutator methods in the model and modifying the views accordingly. |
- | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."`` property. Classes that are already set in the views will not be replaced. |
+ | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."` property. Classes that are already set in the views will not be replaced. |
| date-format | Default value: "m/d/Y H:i A". Any field with the type date, time or datetime can be formatted different when it is displayed. You can change the display format using this option. |
| html-value | A default value to set the field to. When using multiple options based html-type like checkbox, multipleSelect you can set this property to array of values to set multiple values by default. Ex, `["Red","Green"]` |
| options | If you used select, checkbox, or radio for the html-type property, this is where you provide the options. Here are some example of the schema.
A simple array: In this option, the value will be the numeric index value of the item in the array.
```"options": ["Prefer not to say","Male","Female"]```.
Using explicit values
```"options": { "": Prefer not to say", "male": "Male","female": "Female"}```.
Using multiple language phrases for each option
```"options": {"en":{"":"Prefer not to say","male":"Male","female":"Female"},"ar":{"":"Prefer not to say in Arabic","male":"Male in Arabic","female":"Female in Arabic"},"fr":{"":"Prefer not to say in French","male":"Male in French","female":"Female in French"}}``` |
@@ -161,8 +161,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| is-on-index | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index view. |
| is-on-form | Default value: `true`. Setting the value to `false` will prevent from adding this field to the form view. |
| is-on-show | Default value: `true`. Setting the value to `false` will prevent from adding this field to the show view. |
- | is-on-views | Default value: `true`. Setting the value to `false`` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
- | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns`` in the configuration file, allow you to list the common field name to automatically set them as header. |
+ | is-on-views | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
+ | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns` in the configuration file, allow you to list the common field name to automatically set them as header. |
#### Database Properties
| Property name | Description |
diff --git a/docs/versioned_docs/version-2.1.0/available-commands.md b/docs/versioned_docs/version-2.1.0/available-commands.md
index 8ea9488..743c613 100644
--- a/docs/versioned_docs/version-2.1.0/available-commands.md
+++ b/docs/versioned_docs/version-2.1.0/available-commands.md
@@ -183,7 +183,7 @@ All examples below assumes that you already created a [resource-file](./resource
| ----------- | ----------- | ----------- |
| --layout-filename | The name of the layout file to be used. | `app` (i.e, creates `app.blade.php`) |
| --layout-directory | The directory to create the layout under. | `layouts` |
- | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
+ | --c | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
| --force | This option will override the layout if one already exists. | |
:::
@@ -205,28 +205,28 @@ All examples below assumes that you already created a [resource-file](./resource
| Option | Description | Default |
| ----------- | ----------- | ----------- |
- | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
- | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
- | --controller-extends | Specify which class should the controller extends. Note: the default value can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `Http\Controllers\Controller` |
- | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
- | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
- | --models-per-page | How many models to show per page on the index view. | `25` |
- | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
- | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
- | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
- | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
- | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
- | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
- | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
- | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
- | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
- | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
- | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
- | --engine-name | A specific engine name for the database's table can be provided here. | |
- | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
- | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
- | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
- | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
+ | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
+ | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
+ | --controller-extends | Specify which class should the controller extends. Note: the default value can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `Http\Controllers\Controller` |
+ | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
+ | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
+ | --models-per-page | How many models to show per page on the index view. | `25` |
+ | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
+ | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
+ | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
+ | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
+ | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
+ | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
+ | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
+ | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
+ | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
+ | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
+ | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
+ | --engine-name | A specific engine name for the database's table can be provided here. | |
+ | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
+ | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
+ | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
+ | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
| --template-name | [Described above](#template-name) | |
| --force | This option will override the layout if one already exists. | |
@@ -249,7 +249,7 @@ When using `resource-file:create`, `resource-file:from-database` or `resource-fi
| --with-auth | [Described above](#with-auth) |
| --models-per-page | [Described above](#models-per-page) |
| --with-form-request | [Described above](#with-form-request) |
- | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
+ | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
| --form-request-directory | [Described above](#form-request-directory) |
| --table-exists | [Described above](#table-exists) |
| --translation-for | [Described above](#translation-for) |
@@ -296,9 +296,9 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| --form-request-directory | [Described above](#form-request-directory) |
| --model-directory | [Described above](#model-directory) |
| --views-directory | [Described above](#views-directory) |
- | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
- | --without-model | Allow you to create all the resources excluding the model. |
- | --without-views | Allow you to create all the resources excluding the views. |
+ | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
+ | --without-model | Allow you to create all the resources excluding the model. |
+ | --without-views | Allow you to create all the resources excluding the views. |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
:::
@@ -374,8 +374,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| ----------- | ----------- | ----------- |
| --resource-file | [Described above](#resource-file) |
| --routes-prefix | [Described above](#routes-prefix) |
- | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
- | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
+ | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
+ | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
| --views-directory | [Described above](#views-directory) |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
diff --git a/docs/versioned_docs/version-2.1.0/intro.md b/docs/versioned_docs/version-2.1.0/intro.md
index 8523b27..38977fc 100644
--- a/docs/versioned_docs/version-2.1.0/intro.md
+++ b/docs/versioned_docs/version-2.1.0/intro.md
@@ -59,4 +59,4 @@ Explore the project's source code on [GitHub](https://github.com/CrestApps/larav
#### (Optional) Using Laravel-Collective
-Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](using-laravel-collective.md)
+Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](./laravel-collective)
diff --git a/docs/versioned_docs/version-2.1.0/resource-file.md b/docs/versioned_docs/version-2.1.0/resource-file.md
index 52d8448..1de5a7d 100644
--- a/docs/versioned_docs/version-2.1.0/resource-file.md
+++ b/docs/versioned_docs/version-2.1.0/resource-file.md
@@ -31,10 +31,10 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| Option | Description |
| ----------- | ----------- |
- | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
- | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
- | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
- | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
+ | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
+ | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
+ | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
+ | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
| --translation-for | [Described above](#translation-for) |
| --force | This option will override any file that already exist. |
:::
@@ -152,7 +152,7 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| validation | You can pass any valid Laravel validation rule. The rules should be separated by bar `\|`.
For example: `required\|string\|min:2\|max:255`
Start with Laravel 5.5, you can define custom validation rules and pass them as well. For example, to use a custom validation rule called Uppercase in addition to the required rule, you can pass this string required|new Uppercase.
To learn more about the valid options please visit [Laravel documentation](https://laravel.com/docs/master/validation#available-validation-rules).
When the rule `required` is not used, the field in the migration file will automatically become nullable. |
| html-type | Default value: `text`. A valid property will be one of the following options
`text`, `textarea`, `password`,`email`,`checkbox`,`radio`,`number`,`select`,`hidden`,`file`,`selectRange`,`selectMonth`, or `multipleSelect`.
Note: when using file type, after the file is uploaded to the designated path, the filename is stored in the database by default. For everything to work properly, the data-type must be of some sort of a string type. Or modify the behavior of moveFile method to handle the new file.
By default this process stores the uploaded file in the path defined in config file.
Note: when using checkbox, or multipleSelect, the items are stored in the database as JSON string. Additionally, the items in the index or form views are displayed separated by the value provided in the delimiter property. |
| delimiter | Default value: "; ". When generating a form with checkbox or a select menu that accepts multiple answers, we need either store the results in a foreign model or store the records in a string field. By default, the code generator will convert the multiple options that a user selected into a JSON string before the results are stored using a Eloquent-mutator method.
When the data is presented on the show and/or index views, the options are displayed separated by the value of the delimiter. Of course, you can always change this behavior to fit your needs by removing the accessor and mutator methods in the model and modifying the views accordingly. |
- | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."`` property. Classes that are already set in the views will not be replaced. |
+ | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."` property. Classes that are already set in the views will not be replaced. |
| date-format | Default value: "m/d/Y H:i A". Any field with the type date, time or datetime can be formatted different when it is displayed. You can change the display format using this option. |
| html-value | A default value to set the field to. When using multiple options based html-type like checkbox, multipleSelect you can set this property to array of values to set multiple values by default. Ex, `["Red","Green"]` |
| options | If you used select, checkbox, or radio for the html-type property, this is where you provide the options. Here are some example of the schema.
A simple array: In this option, the value will be the numeric index value of the item in the array.
```"options": ["Prefer not to say","Male","Female"]```.
Using explicit values
```"options": { "": Prefer not to say", "male": "Male","female": "Female"}```.
Using multiple language phrases for each option
```"options": {"en":{"":"Prefer not to say","male":"Male","female":"Female"},"ar":{"":"Prefer not to say in Arabic","male":"Male in Arabic","female":"Female in Arabic"},"fr":{"":"Prefer not to say in French","male":"Male in French","female":"Female in French"}}``` |
@@ -161,8 +161,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| is-on-index | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index view. |
| is-on-form | Default value: `true`. Setting the value to `false` will prevent from adding this field to the form view. |
| is-on-show | Default value: `true`. Setting the value to `false` will prevent from adding this field to the show view. |
- | is-on-views | Default value: `true`. Setting the value to `false`` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
- | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns`` in the configuration file, allow you to list the common field name to automatically set them as header. |
+ | is-on-views | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
+ | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns` in the configuration file, allow you to list the common field name to automatically set them as header. |
#### Database Properties
| Property name | Description |
diff --git a/docs/versioned_docs/version-2.2.0/available-commands.md b/docs/versioned_docs/version-2.2.0/available-commands.md
index 8ea9488..1dfcf63 100644
--- a/docs/versioned_docs/version-2.2.0/available-commands.md
+++ b/docs/versioned_docs/version-2.2.0/available-commands.md
@@ -183,7 +183,7 @@ All examples below assumes that you already created a [resource-file](./resource
| ----------- | ----------- | ----------- |
| --layout-filename | The name of the layout file to be used. | `app` (i.e, creates `app.blade.php`) |
| --layout-directory | The directory to create the layout under. | `layouts` |
- | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
+ | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
| --force | This option will override the layout if one already exists. | |
:::
@@ -205,28 +205,28 @@ All examples below assumes that you already created a [resource-file](./resource
| Option | Description | Default |
| ----------- | ----------- | ----------- |
- | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
- | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
- | --controller-extends | Specify which class should the controller extends. Note: the default value can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `Http\Controllers\Controller` |
- | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
- | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
- | --models-per-page | How many models to show per page on the index view. | `25` |
- | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
- | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
- | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
- | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
- | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
- | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
- | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
- | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
- | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
- | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
- | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
- | --engine-name | A specific engine name for the database's table can be provided here. | |
- | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
- | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
- | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
- | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
+ | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
+ | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
+ | --controller-extends | Specify which class should the controller extends. Note: the default value can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `Http\Controllers\Controller` |
+ | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
+ | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
+ | --models-per-page | How many models to show per page on the index view. | `25` |
+ | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
+ | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
+ | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
+ | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
+ | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
+ | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
+ | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
+ | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
+ | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
+ | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
+ | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
+ | --engine-name | A specific engine name for the database's table can be provided here. | |
+ | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
+ | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
+ | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
+ | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
| --template-name | [Described above](#template-name) | |
| --force | This option will override the layout if one already exists. | |
@@ -249,7 +249,7 @@ When using `resource-file:create`, `resource-file:from-database` or `resource-fi
| --with-auth | [Described above](#with-auth) |
| --models-per-page | [Described above](#models-per-page) |
| --with-form-request | [Described above](#with-form-request) |
- | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
+ | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
| --form-request-directory | [Described above](#form-request-directory) |
| --table-exists | [Described above](#table-exists) |
| --translation-for | [Described above](#translation-for) |
@@ -296,9 +296,9 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| --form-request-directory | [Described above](#form-request-directory) |
| --model-directory | [Described above](#model-directory) |
| --views-directory | [Described above](#views-directory) |
- | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
- | --without-model | Allow you to create all the resources excluding the model. |
- | --without-views | Allow you to create all the resources excluding the views. |
+ | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
+ | --without-model | Allow you to create all the resources excluding the model. |
+ | --without-views | Allow you to create all the resources excluding the views. |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
:::
@@ -374,8 +374,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| ----------- | ----------- | ----------- |
| --resource-file | [Described above](#resource-file) |
| --routes-prefix | [Described above](#routes-prefix) |
- | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
- | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
+ | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
+ | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
| --views-directory | [Described above](#views-directory) |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
diff --git a/docs/versioned_docs/version-2.2.0/intro.md b/docs/versioned_docs/version-2.2.0/intro.md
index b8a6e7a..38977fc 100644
--- a/docs/versioned_docs/version-2.2.0/intro.md
+++ b/docs/versioned_docs/version-2.2.0/intro.md
@@ -59,4 +59,4 @@ Explore the project's source code on [GitHub](https://github.com/CrestApps/larav
#### (Optional) Using Laravel-Collective
-Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](./using-laravel-collective)
+Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](./laravel-collective)
diff --git a/docs/versioned_docs/version-2.2.0/resource-file.md b/docs/versioned_docs/version-2.2.0/resource-file.md
index 52d8448..1de5a7d 100644
--- a/docs/versioned_docs/version-2.2.0/resource-file.md
+++ b/docs/versioned_docs/version-2.2.0/resource-file.md
@@ -31,10 +31,10 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| Option | Description |
| ----------- | ----------- |
- | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
- | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
- | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
- | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
+ | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
+ | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
+ | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
+ | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
| --translation-for | [Described above](#translation-for) |
| --force | This option will override any file that already exist. |
:::
@@ -152,7 +152,7 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| validation | You can pass any valid Laravel validation rule. The rules should be separated by bar `\|`.
For example: `required\|string\|min:2\|max:255`
Start with Laravel 5.5, you can define custom validation rules and pass them as well. For example, to use a custom validation rule called Uppercase in addition to the required rule, you can pass this string required|new Uppercase.
To learn more about the valid options please visit [Laravel documentation](https://laravel.com/docs/master/validation#available-validation-rules).
When the rule `required` is not used, the field in the migration file will automatically become nullable. |
| html-type | Default value: `text`. A valid property will be one of the following options
`text`, `textarea`, `password`,`email`,`checkbox`,`radio`,`number`,`select`,`hidden`,`file`,`selectRange`,`selectMonth`, or `multipleSelect`.
Note: when using file type, after the file is uploaded to the designated path, the filename is stored in the database by default. For everything to work properly, the data-type must be of some sort of a string type. Or modify the behavior of moveFile method to handle the new file.
By default this process stores the uploaded file in the path defined in config file.
Note: when using checkbox, or multipleSelect, the items are stored in the database as JSON string. Additionally, the items in the index or form views are displayed separated by the value provided in the delimiter property. |
| delimiter | Default value: "; ". When generating a form with checkbox or a select menu that accepts multiple answers, we need either store the results in a foreign model or store the records in a string field. By default, the code generator will convert the multiple options that a user selected into a JSON string before the results are stored using a Eloquent-mutator method.
When the data is presented on the show and/or index views, the options are displayed separated by the value of the delimiter. Of course, you can always change this behavior to fit your needs by removing the accessor and mutator methods in the model and modifying the views accordingly. |
- | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."`` property. Classes that are already set in the views will not be replaced. |
+ | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."` property. Classes that are already set in the views will not be replaced. |
| date-format | Default value: "m/d/Y H:i A". Any field with the type date, time or datetime can be formatted different when it is displayed. You can change the display format using this option. |
| html-value | A default value to set the field to. When using multiple options based html-type like checkbox, multipleSelect you can set this property to array of values to set multiple values by default. Ex, `["Red","Green"]` |
| options | If you used select, checkbox, or radio for the html-type property, this is where you provide the options. Here are some example of the schema.
A simple array: In this option, the value will be the numeric index value of the item in the array.
```"options": ["Prefer not to say","Male","Female"]```.
Using explicit values
```"options": { "": Prefer not to say", "male": "Male","female": "Female"}```.
Using multiple language phrases for each option
```"options": {"en":{"":"Prefer not to say","male":"Male","female":"Female"},"ar":{"":"Prefer not to say in Arabic","male":"Male in Arabic","female":"Female in Arabic"},"fr":{"":"Prefer not to say in French","male":"Male in French","female":"Female in French"}}``` |
@@ -161,8 +161,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| is-on-index | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index view. |
| is-on-form | Default value: `true`. Setting the value to `false` will prevent from adding this field to the form view. |
| is-on-show | Default value: `true`. Setting the value to `false` will prevent from adding this field to the show view. |
- | is-on-views | Default value: `true`. Setting the value to `false`` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
- | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns`` in the configuration file, allow you to list the common field name to automatically set them as header. |
+ | is-on-views | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
+ | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns` in the configuration file, allow you to list the common field name to automatically set them as header. |
#### Database Properties
| Property name | Description |
diff --git a/docs/versioned_docs/version-2.3.0/available-commands.md b/docs/versioned_docs/version-2.3.0/available-commands.md
index 8ea9488..1dfcf63 100644
--- a/docs/versioned_docs/version-2.3.0/available-commands.md
+++ b/docs/versioned_docs/version-2.3.0/available-commands.md
@@ -183,7 +183,7 @@ All examples below assumes that you already created a [resource-file](./resource
| ----------- | ----------- | ----------- |
| --layout-filename | The name of the layout file to be used. | `app` (i.e, creates `app.blade.php`) |
| --layout-directory | The directory to create the layout under. | `layouts` |
- | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
+ | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
| --force | This option will override the layout if one already exists. | |
:::
@@ -205,28 +205,28 @@ All examples below assumes that you already created a [resource-file](./resource
| Option | Description | Default |
| ----------- | ----------- | ----------- |
- | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
- | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
- | --controller-extends | Specify which class should the controller extends. Note: the default value can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `Http\Controllers\Controller` |
- | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
- | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
- | --models-per-page | How many models to show per page on the index view. | `25` |
- | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
- | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
- | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
- | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
- | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
- | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
- | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
- | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
- | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
- | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
- | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
- | --engine-name | A specific engine name for the database's table can be provided here. | |
- | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
- | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
- | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
- | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
+ | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
+ | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
+ | --controller-extends | Specify which class should the controller extends. Note: the default value can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `Http\Controllers\Controller` |
+ | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
+ | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
+ | --models-per-page | How many models to show per page on the index view. | `25` |
+ | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
+ | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
+ | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
+ | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
+ | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
+ | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
+ | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
+ | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
+ | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
+ | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
+ | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
+ | --engine-name | A specific engine name for the database's table can be provided here. | |
+ | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
+ | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
+ | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
+ | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
| --template-name | [Described above](#template-name) | |
| --force | This option will override the layout if one already exists. | |
@@ -249,7 +249,7 @@ When using `resource-file:create`, `resource-file:from-database` or `resource-fi
| --with-auth | [Described above](#with-auth) |
| --models-per-page | [Described above](#models-per-page) |
| --with-form-request | [Described above](#with-form-request) |
- | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
+ | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
| --form-request-directory | [Described above](#form-request-directory) |
| --table-exists | [Described above](#table-exists) |
| --translation-for | [Described above](#translation-for) |
@@ -296,9 +296,9 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| --form-request-directory | [Described above](#form-request-directory) |
| --model-directory | [Described above](#model-directory) |
| --views-directory | [Described above](#views-directory) |
- | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
- | --without-model | Allow you to create all the resources excluding the model. |
- | --without-views | Allow you to create all the resources excluding the views. |
+ | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
+ | --without-model | Allow you to create all the resources excluding the model. |
+ | --without-views | Allow you to create all the resources excluding the views. |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
:::
@@ -374,8 +374,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| ----------- | ----------- | ----------- |
| --resource-file | [Described above](#resource-file) |
| --routes-prefix | [Described above](#routes-prefix) |
- | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
- | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
+ | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
+ | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
| --views-directory | [Described above](#views-directory) |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
diff --git a/docs/versioned_docs/version-2.3.0/intro.md b/docs/versioned_docs/version-2.3.0/intro.md
index b8a6e7a..38977fc 100644
--- a/docs/versioned_docs/version-2.3.0/intro.md
+++ b/docs/versioned_docs/version-2.3.0/intro.md
@@ -59,4 +59,4 @@ Explore the project's source code on [GitHub](https://github.com/CrestApps/larav
#### (Optional) Using Laravel-Collective
-Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](./using-laravel-collective)
+Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](./laravel-collective)
diff --git a/docs/versioned_docs/version-2.3.0/resource-file.md b/docs/versioned_docs/version-2.3.0/resource-file.md
index 52d8448..1de5a7d 100644
--- a/docs/versioned_docs/version-2.3.0/resource-file.md
+++ b/docs/versioned_docs/version-2.3.0/resource-file.md
@@ -31,10 +31,10 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| Option | Description |
| ----------- | ----------- |
- | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
- | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
- | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
- | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
+ | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
+ | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
+ | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
+ | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
| --translation-for | [Described above](#translation-for) |
| --force | This option will override any file that already exist. |
:::
@@ -152,7 +152,7 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| validation | You can pass any valid Laravel validation rule. The rules should be separated by bar `\|`.
For example: `required\|string\|min:2\|max:255`
Start with Laravel 5.5, you can define custom validation rules and pass them as well. For example, to use a custom validation rule called Uppercase in addition to the required rule, you can pass this string required|new Uppercase.
To learn more about the valid options please visit [Laravel documentation](https://laravel.com/docs/master/validation#available-validation-rules).
When the rule `required` is not used, the field in the migration file will automatically become nullable. |
| html-type | Default value: `text`. A valid property will be one of the following options
`text`, `textarea`, `password`,`email`,`checkbox`,`radio`,`number`,`select`,`hidden`,`file`,`selectRange`,`selectMonth`, or `multipleSelect`.
Note: when using file type, after the file is uploaded to the designated path, the filename is stored in the database by default. For everything to work properly, the data-type must be of some sort of a string type. Or modify the behavior of moveFile method to handle the new file.
By default this process stores the uploaded file in the path defined in config file.
Note: when using checkbox, or multipleSelect, the items are stored in the database as JSON string. Additionally, the items in the index or form views are displayed separated by the value provided in the delimiter property. |
| delimiter | Default value: "; ". When generating a form with checkbox or a select menu that accepts multiple answers, we need either store the results in a foreign model or store the records in a string field. By default, the code generator will convert the multiple options that a user selected into a JSON string before the results are stored using a Eloquent-mutator method.
When the data is presented on the show and/or index views, the options are displayed separated by the value of the delimiter. Of course, you can always change this behavior to fit your needs by removing the accessor and mutator methods in the model and modifying the views accordingly. |
- | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."`` property. Classes that are already set in the views will not be replaced. |
+ | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."` property. Classes that are already set in the views will not be replaced. |
| date-format | Default value: "m/d/Y H:i A". Any field with the type date, time or datetime can be formatted different when it is displayed. You can change the display format using this option. |
| html-value | A default value to set the field to. When using multiple options based html-type like checkbox, multipleSelect you can set this property to array of values to set multiple values by default. Ex, `["Red","Green"]` |
| options | If you used select, checkbox, or radio for the html-type property, this is where you provide the options. Here are some example of the schema.
A simple array: In this option, the value will be the numeric index value of the item in the array.
```"options": ["Prefer not to say","Male","Female"]```.
Using explicit values
```"options": { "": Prefer not to say", "male": "Male","female": "Female"}```.
Using multiple language phrases for each option
```"options": {"en":{"":"Prefer not to say","male":"Male","female":"Female"},"ar":{"":"Prefer not to say in Arabic","male":"Male in Arabic","female":"Female in Arabic"},"fr":{"":"Prefer not to say in French","male":"Male in French","female":"Female in French"}}``` |
@@ -161,8 +161,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| is-on-index | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index view. |
| is-on-form | Default value: `true`. Setting the value to `false` will prevent from adding this field to the form view. |
| is-on-show | Default value: `true`. Setting the value to `false` will prevent from adding this field to the show view. |
- | is-on-views | Default value: `true`. Setting the value to `false`` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
- | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns`` in the configuration file, allow you to list the common field name to automatically set them as header. |
+ | is-on-views | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
+ | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns` in the configuration file, allow you to list the common field name to automatically set them as header. |
#### Database Properties
| Property name | Description |
diff --git a/docs/versioned_docs/version-2.4.0/available-commands.md b/docs/versioned_docs/version-2.4.0/available-commands.md
index 2890d33..5019377 100644
--- a/docs/versioned_docs/version-2.4.0/available-commands.md
+++ b/docs/versioned_docs/version-2.4.0/available-commands.md
@@ -191,7 +191,7 @@ All examples below assumes that you already created a [resource-file](./resource
| ----------- | ----------- | ----------- |
| --layout-filename | The name of the layout file to be used. | `app` (i.e, creates `app.blade.php`) |
| --layout-directory | The directory to create the layout under. | `layouts` |
- | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
+ | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
| --force | This option will override the layout if one already exists. | |
:::
@@ -213,29 +213,29 @@ All examples below assumes that you already created a [resource-file](./resource
| Option | Description | Default |
| ----------- | ----------- | ----------- |
- | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
- | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
- | --controller-extends | Specify which class should the controller extends. Note: the default value is can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `default-controller` which means use the settings from the configurations by default `Http\Controllers\Controller` |
- | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
- | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
- | --models-per-page | How many models to show per page on the index view. | `25` |
- | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
- | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
- | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
- | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
- | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
- | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
- | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
- | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
- | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
- | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
- | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
- | --engine-name | A specific engine name for the database's table can be provided here. | |
- | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
- | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
- | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
- | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
- | --fields | [Described below](#fields) | |
+ | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
+ | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
+ | --controller-extends | Specify which class should the controller extends. Note: the default value is can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `default-controller` which means use the settings from the configurations by default `Http\Controllers\Controller` |
+ | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
+ | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
+ | --models-per-page | How many models to show per page on the index view. | `25` |
+ | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
+ | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
+ | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
+ | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
+ | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
+ | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
+ | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
+ | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
+ | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
+ | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
+ | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
+ | --engine-name | A specific engine name for the database's table can be provided here. | |
+ | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
+ | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
+ | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
+ | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
+ | --fields | [Described here](./resource-file#fields) | |
| --template-name | [Described above](#template-name) | |
| --force | This option will override the layout if one already exists. | |
:::
@@ -257,7 +257,7 @@ When using `resource-file:create`, `resource-file:from-database` or `resource-fi
| --with-auth | [Described above](#with-auth) |
| --models-per-page | [Described above](#models-per-page) |
| --with-form-request | [Described above](#with-form-request) |
- | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
+ | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
| --form-request-directory | [Described above](#form-request-directory) |
| --table-exists | [Described above](#table-exists) |
| --translation-for | [Described above](#translation-for) |
@@ -304,9 +304,9 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| --form-request-directory | [Described above](#form-request-directory) |
| --model-directory | [Described above](#model-directory) |
| --views-directory | [Described above](#views-directory) |
- | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
- | --without-model | Allow you to create all the resources excluding the model. |
- | --without-views | Allow you to create all the resources excluding the views. |
+ | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
+ | --without-model | Allow you to create all the resources excluding the model. |
+ | --without-views | Allow you to create all the resources excluding the views. |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
:::
@@ -385,8 +385,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| ----------- | ----------- | ----------- |
| --resource-file | [Described above](#resource-file) |
| --routes-prefix | [Described above](#routes-prefix) |
- | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
- | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
+ | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
+ | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
| --views-directory | [Described above](#views-directory) |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
diff --git a/docs/versioned_docs/version-2.4.0/intro.md b/docs/versioned_docs/version-2.4.0/intro.md
index b8a6e7a..38977fc 100644
--- a/docs/versioned_docs/version-2.4.0/intro.md
+++ b/docs/versioned_docs/version-2.4.0/intro.md
@@ -59,4 +59,4 @@ Explore the project's source code on [GitHub](https://github.com/CrestApps/larav
#### (Optional) Using Laravel-Collective
-Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](./using-laravel-collective)
+Laravel-Code-Generator is fully capable of generating views using Laravel-Collective. To Generate views using it, you must first install Laravel-Collective into your project. Instructions on how to use it can be found [Laravel-Collective](./laravel-collective)
diff --git a/docs/versioned_docs/version-2.4.0/resource-file.md b/docs/versioned_docs/version-2.4.0/resource-file.md
index 52d8448..1de5a7d 100644
--- a/docs/versioned_docs/version-2.4.0/resource-file.md
+++ b/docs/versioned_docs/version-2.4.0/resource-file.md
@@ -31,10 +31,10 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| Option | Description |
| ----------- | ----------- |
- | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
- | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
- | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
- | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
+ | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
+ | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
+ | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
+ | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
| --translation-for | [Described above](#translation-for) |
| --force | This option will override any file that already exist. |
:::
@@ -152,7 +152,7 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| validation | You can pass any valid Laravel validation rule. The rules should be separated by bar `\|`.
For example: `required\|string\|min:2\|max:255`
Start with Laravel 5.5, you can define custom validation rules and pass them as well. For example, to use a custom validation rule called Uppercase in addition to the required rule, you can pass this string required|new Uppercase.
To learn more about the valid options please visit [Laravel documentation](https://laravel.com/docs/master/validation#available-validation-rules).
When the rule `required` is not used, the field in the migration file will automatically become nullable. |
| html-type | Default value: `text`. A valid property will be one of the following options
`text`, `textarea`, `password`,`email`,`checkbox`,`radio`,`number`,`select`,`hidden`,`file`,`selectRange`,`selectMonth`, or `multipleSelect`.
Note: when using file type, after the file is uploaded to the designated path, the filename is stored in the database by default. For everything to work properly, the data-type must be of some sort of a string type. Or modify the behavior of moveFile method to handle the new file.
By default this process stores the uploaded file in the path defined in config file.
Note: when using checkbox, or multipleSelect, the items are stored in the database as JSON string. Additionally, the items in the index or form views are displayed separated by the value provided in the delimiter property. |
| delimiter | Default value: "; ". When generating a form with checkbox or a select menu that accepts multiple answers, we need either store the results in a foreign model or store the records in a string field. By default, the code generator will convert the multiple options that a user selected into a JSON string before the results are stored using a Eloquent-mutator method.
When the data is presented on the show and/or index views, the options are displayed separated by the value of the delimiter. Of course, you can always change this behavior to fit your needs by removing the accessor and mutator methods in the model and modifying the views accordingly. |
- | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."`` property. Classes that are already set in the views will not be replaced. |
+ | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."` property. Classes that are already set in the views will not be replaced. |
| date-format | Default value: "m/d/Y H:i A". Any field with the type date, time or datetime can be formatted different when it is displayed. You can change the display format using this option. |
| html-value | A default value to set the field to. When using multiple options based html-type like checkbox, multipleSelect you can set this property to array of values to set multiple values by default. Ex, `["Red","Green"]` |
| options | If you used select, checkbox, or radio for the html-type property, this is where you provide the options. Here are some example of the schema.
A simple array: In this option, the value will be the numeric index value of the item in the array.
```"options": ["Prefer not to say","Male","Female"]```.
Using explicit values
```"options": { "": Prefer not to say", "male": "Male","female": "Female"}```.
Using multiple language phrases for each option
```"options": {"en":{"":"Prefer not to say","male":"Male","female":"Female"},"ar":{"":"Prefer not to say in Arabic","male":"Male in Arabic","female":"Female in Arabic"},"fr":{"":"Prefer not to say in French","male":"Male in French","female":"Female in French"}}``` |
@@ -161,8 +161,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| is-on-index | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index view. |
| is-on-form | Default value: `true`. Setting the value to `false` will prevent from adding this field to the form view. |
| is-on-show | Default value: `true`. Setting the value to `false` will prevent from adding this field to the show view. |
- | is-on-views | Default value: `true`. Setting the value to `false`` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
- | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns`` in the configuration file, allow you to list the common field name to automatically set them as header. |
+ | is-on-views | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
+ | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns` in the configuration file, allow you to list the common field name to automatically set them as header. |
#### Database Properties
| Property name | Description |
diff --git a/docs/versioned_docs/version-3.0.0/available-commands.md b/docs/versioned_docs/version-3.0.0/available-commands.md
index 5b420d5..5f691e5 100644
--- a/docs/versioned_docs/version-3.0.0/available-commands.md
+++ b/docs/versioned_docs/version-3.0.0/available-commands.md
@@ -196,7 +196,7 @@ All examples below assumes that you already created a [resource-file](./resource
| ----------- | ----------- | ----------- |
| --layout-filename | The name of the layout file to be used. | `app` (i.e, creates `app.blade.php`) |
| --layout-directory | The directory to create the layout under. | `layouts` |
- | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
+ | --template-name | This option allows you to use a different template at run time. When this option is left out, the default template is used.
Note: the default template can be set from the config file (i.e `config/laravel-code-generator.php`) by setting the template key to a different value. | `layouts` |
| --force | This option will override the layout if one already exists. | |
:::
@@ -218,29 +218,29 @@ All examples below assumes that you already created a [resource-file](./resource
| Option | Description | Default |
| ----------- | ----------- | ----------- |
- | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
- | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
- | --controller-extends | Specify which class should the controller extends. Note: the default value is can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `default-controller` which means use the settings from the configurations by default `Http\Controllers\Controller` |
- | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
- | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
- | --models-per-page | How many models to show per page on the index view. | `25` |
- | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
- | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
- | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
- | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
- | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
- | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
- | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
- | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
- | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
- | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
- | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
- | --engine-name | A specific engine name for the database's table can be provided here. | |
- | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
- | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
- | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
- | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
- | --fields | [Described below](#fields) | |
+ | --resource-file | The name of the file to import resource from. This option allows you to have all resources such as fields, indexes and relations in one JSON file, and then import it from the command line. This is a powerful feature which makes it easy to configure the fields, then reuse the same fields in multiple command now or in the future. More documentation on how to manage [resource-file](./resource-file.md) can be found in the "Managing fields using JSON file" section. | the plural-form of the model name. If the model name is AssetCategory, the name will then be asset_categories.json |
+ | --controller-name | The name of the controller to create. If the provided value does not end with the word "Controller" it will be appended. | The controller's name will be generated using the plural-form of the giving model's name. In the above example, the controller will be called "PostsController". |
+ | --controller-extends | Specify which class should the controller extends. Note: the default value is can be set change by modifying config file (i.e `config/laravel-code-generator.php`). | `default-controller` which means use the settings from the configurations by default `Http\Controllers\Controller` |
+ | --with-auth | Adds the `auth:api` to the controller which prevents any un-authenticated users to access the resources. | |
+ | --routes-prefix | Prefix of the route group. | `default-form` which uses the plural-form of the model name. However, this is something can be changed from the configuration file `plural_names_for` key. |
+ | --models-per-page | How many models to show per page on the index view. | `25` |
+ | --with-form-request | Instead of placing the field's validation rules directly in the controller class, this option will extract the rules into a separate form-request class. The form-request class allows you to do more complex validation, cleans up your controller, and increases your code reusability. By default, the method `authorize()` is set to return false for your application's security. This method must be modified to return a true value for the store and update requests to be allowed. Otherwise, the request will be Forbidden. When using `--with-auth` option, the `authorize()` method return `Auth::check()` which should always return true at this point. | |
+ | --table-name | The database's table name. If this option is left out, it is assumed that the table name is the plural-form of the model-name. In the above example, the table name will be "posts". If the model name is AssetCategory, the table name will be "asset_categories". | |
+ | --table-exists | This option allows you to generate resources from existing database table. When this option is used, the database's name is assumes to be the plural-form of the provided "model-name". Of course, the table name can be set to a different value by passing the `--table-name option`.
When using this option, the command `php artisan resource-file:from-database` is called behind the scenes to generate a a [resource-file](./resource-file.md) first. The name of the generated [resource-file](./resource-file.md) will be named the plural-form of the model, unless an explicit name is provided using the `--resource-file`` option. This file will allow you to change the default behavior and recreate the view to fit your needs.
This option is currently available only for MySql database only. It will not work if used with a different driver.
Note: To create multiple-language translation from existing database, use the `--translation-for option`. |
+ | --translation-for | A comma separated languages. When creating resources from existing database using the `--table-exists options`, `--translation-for` allows you to create multi-language labels. You still have to provide translation for the corresponding language but it will get everything setup for you.
If this option is left out, no translation key's will be generated.
For example, passing `--translation-for=en,ar,fr` will create label under the following languages en, ar and fr.
This option will only work when using `--table-exists` option otherwise it is ignored. | |
+ | --language-filename | The languages file name to put the labels "if any" in. When no value is provided, the file name will be the plural-form of the provided model name.
Note: if the file already exists, and the same key field name exists in the file, no message will be added.
This option will only work when using --table-exists option. | |
+ | --primary-key | The field's name of the primary key. The default value can be overridden by setting the is-auto-increment or the is-primary flag to true in the fields setup. | `id` |
+ | --with-soft-delete | Enables the soft-delete feature that Eloquent provides. | |
+ | --without-timestamps | Prevent Eloquent from maintaining both `created_at` and the `updated_at` properties. | |
+ | --with-migration | This option will create a migration for your resource.
Behind the scenes, this option invokes the `create:migration` command to create the required migration. | |
+ | --migration-class-name | The name of the migration class. If this option is not set, a name will be generated based on the model name. | |
+ | --connection-name | Eloquent uses the configured default database connection. Providing a value here will tell Eloquent to connect using the provided connection. | |
+ | --engine-name | A specific engine name for the database's table can be provided here. | |
+ | --controller-directory | The directory where the controller should be created under. For example, if the word "Frontend" was provided, the controller will be created in `App/Http/Controllers/Frontend` directory.
The default path where the controller will be created can be set from the config file `config/laravel-code-generator.php`. | |
+ | --model-directory | A directory where the model will be created under. The default path where the model will be created can be set from the config file `config/laravel-code-generator.php`.| |
+ | --views-directory | The name of the directory to create the views under. If this option is left out, the views will be created in `/resources/views` | |
+ | --form-request-directory | The directory where the form-request should be created under.
For example, if the word "Frontend" was provided, the form-request will be created in `App/Http/Requests/Frontend` directory. The default path where the form-request will be created can be set from the config file `config/laravel-code-generator.php` |
+ | --fields | [Described here](./resource-file#fields) | |
| --template-name | [Described above](#template-name) | |
| --force | This option will override the layout if one already exists. | |
:::
@@ -262,7 +262,7 @@ When using `resource-file:create`, `resource-file:from-database` or `resource-fi
| --with-auth | [Described above](#with-auth) |
| --models-per-page | [Described above](#models-per-page) |
| --with-form-request | [Described above](#with-form-request) |
- | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
+ | --without-form-request | Allow you to create all the resources excluding the form-request if one is used. Note: when creating a controller with a form-request the form-request is injected into the action methods. Thus, in order to create the form-request based controller, you would have to use `--with-form-request` and `--with-form-request` so the controller know you are using form-request but avoid overriding existing form-request. |
| --form-request-directory | [Described above](#form-request-directory) |
| --table-exists | [Described above](#table-exists) |
| --translation-for | [Described above](#translation-for) |
@@ -309,9 +309,9 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| --form-request-directory | [Described above](#form-request-directory) |
| --model-directory | [Described above](#model-directory) |
| --views-directory | [Described above](#views-directory) |
- | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
- | --without-model | Allow you to create all the resources excluding the model. |
- | --without-views | Allow you to create all the resources excluding the views. |
+ | --without-languages | Allow you to create all the resources excluding the language file if one is needed. Note: the language file will only be created if the resource file contains translations. |
+ | --without-model | Allow you to create all the resources excluding the model. |
+ | --without-views | Allow you to create all the resources excluding the views. |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
:::
@@ -390,8 +390,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| ----------- | ----------- | ----------- |
| --resource-file | [Described above](#resource-file) |
| --routes-prefix | [Described above](#routes-prefix) |
- | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
- | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
+ | --layout-name | Default value `layouts.app`. A different layout could be used to generate the views. This can easily be done by providing a different layout name. For example, if the physical path to a different layout was `/resources/views/layouts/template/newlayout.blade.php`` then its name would be `layouts.template.newlayout`. |
+ | --only-views | The only views to be created. A comma separated string with the name of the views to create. By default, create the create,edit,index,show, and form views. |
| --views-directory | [Described above](#views-directory) |
| --template-name | [Described above](#template-name) |
| --force | This option will override any file that already exist. |
diff --git a/docs/versioned_docs/version-3.0.0/resource-file.md b/docs/versioned_docs/version-3.0.0/resource-file.md
index 52d8448..1de5a7d 100644
--- a/docs/versioned_docs/version-3.0.0/resource-file.md
+++ b/docs/versioned_docs/version-3.0.0/resource-file.md
@@ -31,10 +31,10 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| Option | Description |
| ----------- | ----------- |
- | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
- | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
- | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
- | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
+ | --resource-filename | The name of the file to be created. When this option is left out, the file will be the plural-form of the model name. If the model name is `AssetCategory`, the file name will be `asset_categories.json`. |
+ | --fields | A list of the field names to be created. The names should be separated by a comma.
You may also pass a complex string using the following schema
`--fields="name:colors;html-type:select;options:blue\|yellow\|green\|red\|white,name:second_field_name"`
Complex string are allowed and will be handy is some cases. However, in most cases all you need to pass is the field names as the common_definitions key in the configuration file will define most options for you out of the box using the name of the field.
Each field in the complex string must be seperated by a `,`. Also each property in the field must be seperated by `;` while each option of a property is seperated by `\|`. |
+ | --relations | A list of the relations to be created. The string should follow the schema below
`--relations="name:comments;type:hasMany;field:title;params:App\Models\Comment\|post_id\|id"`
Each relation in the string must be seperated by a `,`. Also each property in the relation must be seperated by `;` while each parameter of the params property seperated by `\|`. |
+ | --indexes | A list of the indexes to be created. The string should follow the schema below
`--indexes="name:first_last_name_index;columns:first_name\|last_name"`.
Each index in the string must be seperated by a `,`. Also each property in the index must be seperated by `;` while each field name in the columns property seperated `\|`.|
| --translation-for | [Described above](#translation-for) |
| --force | This option will override any file that already exist. |
:::
@@ -152,7 +152,7 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| validation | You can pass any valid Laravel validation rule. The rules should be separated by bar `\|`.
For example: `required\|string\|min:2\|max:255`
Start with Laravel 5.5, you can define custom validation rules and pass them as well. For example, to use a custom validation rule called Uppercase in addition to the required rule, you can pass this string required|new Uppercase.
To learn more about the valid options please visit [Laravel documentation](https://laravel.com/docs/master/validation#available-validation-rules).
When the rule `required` is not used, the field in the migration file will automatically become nullable. |
| html-type | Default value: `text`. A valid property will be one of the following options
`text`, `textarea`, `password`,`email`,`checkbox`,`radio`,`number`,`select`,`hidden`,`file`,`selectRange`,`selectMonth`, or `multipleSelect`.
Note: when using file type, after the file is uploaded to the designated path, the filename is stored in the database by default. For everything to work properly, the data-type must be of some sort of a string type. Or modify the behavior of moveFile method to handle the new file.
By default this process stores the uploaded file in the path defined in config file.
Note: when using checkbox, or multipleSelect, the items are stored in the database as JSON string. Additionally, the items in the index or form views are displayed separated by the value provided in the delimiter property. |
| delimiter | Default value: "; ". When generating a form with checkbox or a select menu that accepts multiple answers, we need either store the results in a foreign model or store the records in a string field. By default, the code generator will convert the multiple options that a user selected into a JSON string before the results are stored using a Eloquent-mutator method.
When the data is presented on the show and/or index views, the options are displayed separated by the value of the delimiter. Of course, you can always change this behavior to fit your needs by removing the accessor and mutator methods in the model and modifying the views accordingly. |
- | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."`` property. Classes that are already set in the views will not be replaced. |
+ | css-class | You can add custom css class(es) to the html input. Any value is placed in this option will be appended to the field's `class="..."` property. Classes that are already set in the views will not be replaced. |
| date-format | Default value: "m/d/Y H:i A". Any field with the type date, time or datetime can be formatted different when it is displayed. You can change the display format using this option. |
| html-value | A default value to set the field to. When using multiple options based html-type like checkbox, multipleSelect you can set this property to array of values to set multiple values by default. Ex, `["Red","Green"]` |
| options | If you used select, checkbox, or radio for the html-type property, this is where you provide the options. Here are some example of the schema.
A simple array: In this option, the value will be the numeric index value of the item in the array.
```"options": ["Prefer not to say","Male","Female"]```.
Using explicit values
```"options": { "": Prefer not to say", "male": "Male","female": "Female"}```.
Using multiple language phrases for each option
```"options": {"en":{"":"Prefer not to say","male":"Male","female":"Female"},"ar":{"":"Prefer not to say in Arabic","male":"Male in Arabic","female":"Female in Arabic"},"fr":{"":"Prefer not to say in French","male":"Male in French","female":"Female in French"}}``` |
@@ -161,8 +161,8 @@ The argument `[model-name]` should be replaced with the name of the model you ar
| is-on-index | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index view. |
| is-on-form | Default value: `true`. Setting the value to `false` will prevent from adding this field to the form view. |
| is-on-show | Default value: `true`. Setting the value to `false` will prevent from adding this field to the show view. |
- | is-on-views | Default value: `true`. Setting the value to `false`` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
- | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns`` in the configuration file, allow you to list the common field name to automatically set them as header. |
+ | is-on-views | Default value: `true`. Setting the value to `false` will prevent from adding this field to the index, form or show view. This is just a short way to change the visibility for all views. |
+ | is-header | Default value: false. Only one field can be set to a header. The header field will be use as the page header in the show view. The key `common_header_patterns` in the configuration file, allow you to list the common field name to automatically set them as header. |
#### Database Properties
| Property name | Description |