|
9 | 9 | | |
10 | 10 | | Here you change the stub templates to use when generating code. |
11 | 11 | | You can duplicate the 'default' template folder |
12 | | - | and call it what ever template your like 'ex. skyblue'. |
| 12 | + | and call it what ever template name you like 'ex. skyblue'. |
13 | 13 | | Now, you can change the stubs to have your own templates generated. |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | IMPORTANT: It is not recomended to modify the default template, rather create a new template. |
17 | 17 | | If you modify the default template and then executed 'php artisan vendor:publish' command, |
18 | | - | it will override the default template causing you to lose your modification. |
| 18 | + | will override your changes! |
19 | 19 | | |
20 | 20 | */ |
21 | 21 | 'template' => 'default', |
|
38 | 38 | | If you want to generate code by using laravel-collective, you must first |
39 | 39 | | install the package. Then add the tamplate name that should be using |
40 | 40 | | Laravel-Collective extensions when generating code. |
| 41 | + | |
| 42 | + | |
41 | 43 | */ |
42 | 44 | 'laravel_collective_templates' => [ |
43 | 45 | 'default-collective' |
|
57 | 59 | | The default output format for datetime fields. |
58 | 60 | |-------------------------------------------------------------------------- |
59 | 61 | | |
| 62 | + | This output format can also be changed at the field level using the |
| 63 | + | "date-format" property of the field. |
60 | 64 | | |
61 | 65 | */ |
62 | 66 | 'datetime_out_format' => 'm/d/Y H:i A', |
63 | 67 |
|
64 | 68 | /* |
65 | 69 | |-------------------------------------------------------------------------- |
66 | | - | The default path of where the field json files are located. |
| 70 | + | The default path of where the json field files are located. |
67 | 71 | |-------------------------------------------------------------------------- |
68 | 72 | | |
69 | 73 | | In this path, you can create json file to import the fields from. |
|
108 | 112 |
|
109 | 113 | /* |
110 | 114 | |-------------------------------------------------------------------------- |
111 | | - | The name of the default resource mapper. |
| 115 | + | The name of the default resources map file. |
112 | 116 | |-------------------------------------------------------------------------- |
113 | 117 | */ |
114 | 118 | 'default_mapper_file_name' => 'resources_map.json', |
|
136 | 140 | | placeholders for the html code. Here you can define which html-types should |
137 | 141 | | the generator create placeholder for. Also, you can define how would you like |
138 | 142 | | the text to read when no placeholder is assigned. |
| 143 | + | |
| 144 | + | The follwowing templates can be used to. assuming the field name is owner_name |
| 145 | + | [% field_name %] <=> "owner name" |
| 146 | + | [% field_name_sentence %] <=> "Owner name" |
| 147 | + | [% field_name_plural %] <=> "owner names" |
| 148 | + | [% field_name_plural_title %] <=> "Owner Names" |
| 149 | + | [% field_name_snake %] <=> "owner_name" |
| 150 | + | [% field_name_studly %] <=> "OwnerName" |
| 151 | + | [% field_name_slug %] <=> "owner-name" |
| 152 | + | [% field_name_kebab %] <=> "owner-name" |
| 153 | + | [% field_name_title %] <=> "Owner Name" |
| 154 | + | [% field_name_title_upper %] <=> "OWNER NAME" |
| 155 | + | [% field_name_plural_variable %] <=> "ownerNames" |
| 156 | + | [% field_name_singular_variable %] <=> "ownerName" |
139 | 157 | */ |
140 | 158 | 'placeholder_by_html_type' => |
141 | 159 | [ |
142 | 160 | 'text' => 'Enter [% field_name %] here...', |
143 | 161 | 'number' => 'Enter [% field_name %] here...', |
| 162 | + 'password' => 'Enter [% field_name %] here...', |
| 163 | + 'email' => 'Enter [% field_name %] here...', |
144 | 164 | 'select' => 'Select [% field_name %]', |
145 | 165 | ], |
146 | 166 |
|
|
151 | 171 | | |
152 | 172 | | When creating resources from existing database, the codegenerator scans |
153 | 173 | | the field's name for a mattching pattern. When found, these field are considred |
154 | | - | foreign keys even if the database does not have a foreign constraints. |
| 174 | + | foreign keys even when the database does not have a foreign constraints. |
155 | 175 | | Here you can specify patterns to help the generator understand your |
156 | 176 | | database naming convension. |
157 | 177 | | |
|
163 | 183 | | Patterns to use to pre-set field's properties. |
164 | 184 | |-------------------------------------------------------------------------- |
165 | 185 | | |
166 | | - | To make constructing fields easy, the codegenerator scans the field's name |
167 | | - | for a matching pattern. If the name matches any of the set pattern, the the |
168 | | - | field's properties will be preset. defining pattern will save you from having |
169 | | - | to re-define the properties for common fields. |
| 186 | + | To make constructing fields easy, the code-generator scans the field's name |
| 187 | + | for a matching pattern. If the name matches any of these patterns, the |
| 188 | + | field's properties will be set accordingly. Defining pattern will save |
| 189 | + | you from having to re-define the properties for common fields. |
170 | 190 | | |
171 | 191 | */ |
172 | 192 | 'common_definitions' => [ |
|
201 | 221 | ] |
202 | 222 | ], |
203 | 223 | [ |
204 | | - 'match' => ['picture','file'], |
| 224 | + 'match' => ['picture','file','photo'], |
205 | 225 | 'set' => [ |
206 | 226 | 'is-on-index' => false, |
207 | 227 | 'html-type' => 'file', |
208 | 228 | ] |
209 | 229 | ], |
| 230 | + [ |
| 231 | + 'match' => ['*password*'], |
| 232 | + 'set' => [ |
| 233 | + 'html-type' => 'password' |
| 234 | + ] |
| 235 | + ], |
| 236 | + [ |
| 237 | + 'match' => ['*email*'], |
| 238 | + 'set' => [ |
| 239 | + 'html-type' => 'email' |
| 240 | + ] |
| 241 | + ], |
210 | 242 | [ |
211 | 243 | 'match' => ['*_id','*_by'], |
212 | 244 | 'set' => [ |
|
295 | 327 | | The "in-function-with-collective" key of the sub array, tell the generator that, |
296 | 328 | | this string would be used in a function or not. |
297 | 329 | | |
| 330 | + | The follwowing templates can be used. Assuming the model name is AssetCategory |
| 331 | + | [% model_name %] <=> "asset category" |
| 332 | + | [% model_name_sentence %] <=> "Asset category" |
| 333 | + | [% model_name_plural %] <=> "asset categories" |
| 334 | + | [% model_name_plural_title %] <=> "Asset Category" |
| 335 | + | [% model_name_snake %] <=> "asset_category" |
| 336 | + | [% model_name_studly %] <=> "AssetCategory" |
| 337 | + | [% model_name_slug %] <=> "asset-category" |
| 338 | + | [% model_name_kebab %] <=> "asset-category" |
| 339 | + | [% model_name_title %] <=> "Asset Category" |
| 340 | + | [% model_name_title_upper %] <=> "ASSET CATEGORY" |
| 341 | + | [% model_name_plural_variable %] <=> "assetCategories" |
| 342 | + | [% model_name_singular_variable %] <=> "assetCategory" |
| 343 | + | |
| 344 | + | ~Example |
| 345 | + | Lets say we need to add a new template in our views that reads the following |
| 346 | + | "Creating resources for ... was a breeze!" |
| 347 | + | The following entry can be added to the below array |
| 348 | + | |
| 349 | + | 'custom_template_1' => [ |
| 350 | + | 'text' => 'Creating resources for [% model_name %] was a breeze!', |
| 351 | + | 'template' => 'custom_template_example', |
| 352 | + | ], |
| 353 | + | Finally, add [% custom_template_example %] in the view where you want it to appear! |
| 354 | + | |
| 355 | + | |
298 | 356 | */ |
299 | 357 | 'generic_view_labels' => [ |
300 | 358 | 'create' => [ |
|
0 commit comments