Skip to content

Commit e4734f6

Browse files
authored
Update the default template to Bootstrap 5.3 and drop support for laravel-collective
2 parents b502395 + 68bb0f3 commit e4734f6

File tree

180 files changed

+1125
-3421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+1125
-3421
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- The `create:routes` command now has a new option `without-route-clause` which will create the routes without `there` clause for the id. It may be used when the primary key is not an integer. Additionally, the options `--for-api` and `--api-version` have been added to add support for created api-based routes.
1111
- added command to create api-resource with/without collection when using Laravel 5.5+.
1212
- The `create:api-scaffold` command have been added to allow you to create resources for the api.
13-
- The user is no longer required to publish the default templates. This is much better step to prevent upgrade braking when the template are updated during a patch release. The user should publish templates only if he/she want to modify it and rename it. **IMPORTANT** Delete existing default and default-collective templates from the folders from the default publish path of your project.
13+
- The user is no longer required to publish the default templates. This is much better step to prevent upgrade braking when the template are updated during a patch release. The user should publish templates only if he/she want to modify it and rename it. **IMPORTANT** Delete existing `default` templates from the folders from the default publish path of your project.
1414
- The user no longer have to publish resource to install the package! One line only is required to install the package on laravel 5.5+ (i.e, composer require crestapps/laravel-code-generator --dev)
1515
- **IMPORTANT**: delete the the `codegenerator.php` file from your config folder, then rename the `codegenerator_custom.php` file to `laravel-code-generator.php`. Alternatively, you can delete both `codegenerator.php` and `codegenerator_custom.php`
1616
- Added `--model-extends` option to the create:model command to allow the use to extend a custom default base class.

README.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ An intelligent code generator for Laravel framework that will save you time! Thi
77

88
For full documentation and live demo please visit <a href="https://crestapps.com/laravel-code-generator/docs/2.3" target="_blank" title="Laravel Code Generator Documentation">CrestApps.com</a>
99

10-
**Note: ** The available documentation is for versions <= 2.2. The documentation for vertion 2.3+ is very similar with some exceptions. Please review the <a href="https://github.com/CrestApps/laravel-code-generator/blob/master/CHANGELOG.md" title="ChangeLog">Change Log</a> to get a list of the changes.
10+
**Note: ** The available documentation is for versions <= 2.2. The documentation for version 2.3+ is very similar with some exceptions. Please review the <a href="https://github.com/CrestApps/laravel-code-generator/blob/master/CHANGELOG.md" title="ChangeLog">Change Log</a> to get a list of the changes.
1111

1212
## Features
1313

@@ -22,7 +22,7 @@ For full documentation and live demo please visit <a href="https://crestapps.com
2222
<li>Allows you to save the fields in a JSON file and recreate resources when the business needs changes.</li>
2323
<li>Utilizes JSON based resource-file to allow you to define your resources. Resource-file allows you to easily regenerate the resource at any time even when the business rules change.</li>
2424
<li>Create standard CRUD controllers with simple or form-request validation.</li>
25-
<li>Customizable view’s templates to enable you to change the standard look and feel of your application.</li>
25+
<li>Customizable view templates to enable you to change the standard look and feel of your application.</li>
2626
<li>Create model with relations.</li>
2727
<li>Create named routes with and without group.</li>
2828
<li>Create standard CRUD views.</li>
@@ -34,34 +34,34 @@ For full documentation and live demo please visit <a href="https://crestapps.com
3434
<li>Client-side validation.</li>
3535
<li>File uploading handling.</li>
3636
<li>Auto store multiple-response in the database.</li>
37-
<li>Create form-request to clean up your controller and increase your code reusability.</li>
37+
<li>Create form-request to clean up your controller and increase your code re-usability.</li>
3838
<li>Create view's layouts with and without client-side validation.</li>
3939
<li>Change the template at run time to generate different views.</li>
4040
<li>Ability to generate views with and without Laravel-Collective.</li>
41-
<li>Nicely handles any date, time or datetime field.</li>
41+
<li>Nicely handles any date, time or DateTime field.</li>
4242
<li>Auto handles any boolean field.</li>
4343
<li>Very easy to use with lots of documentation.</li>
4444
</ul>
4545

4646
## Installation
4747

48-
1. To download this package into your laravel project, use the command-line to execute the following command
48+
1. To download this package into your Laravel project, use the command-line to execute the following command
4949

5050
```
5151
composer require crestapps/laravel-code-generator --dev
5252
```
5353

5454
2. **(You may skip this step when using Laravel >= 5.5)** To bootstrap the packages into your project while using command-line only, open the app/Providers/AppServiceProvider.php file in your project. Then, add the following code to the register() method.
5555

56-
Add the following line to bootstrap laravel-code-generator to the framework.
56+
Add the following line to bootstrap `laravel-code-generator` to the framework.
5757

5858
```
5959
if ($this->app->runningInConsole()) {
6060
$this->app->register('CrestApps\CodeGenerator\CodeGeneratorServiceProvider');
6161
}
6262
```
6363

64-
> A layout is required for the default views! The code generator allows you to create a layout using the command-line. Of cource you can use your own layout. You'll only need to include [CSS bootstrap framework](http://getbootstrap.com/ "CSS bootstrap framework") in your layout for the default templates to work properly. Additionally, you can chose to you design your own templetes using a different or no css framework.
64+
> A layout is required for the default views! The code generator allows you to create a layout using the command-line. Of course you can use your own layout. You'll only need to include [CSS bootstrap framework](http://getbootstrap.com/ "CSS bootstrap framework") in your layout for the default templates to work properly. Additionally, you can chose to you design your own templates using a different or no css framework.
6565
6666
## Lessons
6767
Checkout our channel on <a href="https://www.youtube.com/channel/UCkEd0nOoRf3o0ahspAu7Y9w/videos" target="_blank" title="CrestApps YouTube Channel">YouTube.com</a>
@@ -93,6 +93,12 @@ Checkout our channel on <a href="https://www.youtube.com/channel/UCkEd0nOoRf3o0a
9393
<li>php artisan create:api-scaffold [model-name]</li>
9494
<li>php artisan create:api-controller [model-name]</li>
9595
<li>php artisan create:api-resources [model-name]</li>
96+
</ul>
97+
</li>
98+
<li>
99+
<strong>API Documentations commands</strong>
100+
<ul>
101+
<li>php artisan api-docs:scaffold [model-name]</li>
96102
<li>php artisan api-doc:create-controller [model-name]</li>
97103
<li>php artisan api-doc:create-view [model-name]</li>
98104
</ul>
@@ -250,4 +256,3 @@ The following example assumes that we are trying to create a CRUD called <var>As
250256
## License
251257

252258
"Laravel Code Generator" is an open-sourced software licensed under the <a href="https://opensource.org/licenses/MIT" target="_blank" title="MIT license">MIT license</a>
253-

config/default.php

+36-42
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,6 @@
3030
*/
3131
'templates_path' => 'resources/laravel-code-generator/templates',
3232

33-
/*
34-
|--------------------------------------------------------------------------
35-
| Array of templates that should be generated with Laravel-Collective.
36-
|--------------------------------------------------------------------------
37-
|
38-
| If you want to generate code by using laravel-collective, you must first
39-
| install the package. Then add the tamplate name that should be using
40-
| Laravel-Collective extensions when generating code.
41-
|
42-
*/
43-
'laravel_collective_templates' => [
44-
'default-collective',
45-
],
46-
4733
/*
4834
|--------------------------------------------------------------------------
4935
| The default path of where the uploaded files live.
@@ -59,7 +45,7 @@
5945

6046
/*
6147
|--------------------------------------------------------------------------
62-
| The default output format for datetime fields.
48+
| The default output format for DateTime fields.
6349
|--------------------------------------------------------------------------
6450
|
6551
| This output format can also be changed at the field level using the
@@ -70,10 +56,10 @@
7056

7157
/*
7258
|--------------------------------------------------------------------------
73-
| The default path of where the json resource-files are located.
59+
| The default path of where the JSON resource-files are located.
7460
|--------------------------------------------------------------------------
7561
|
76-
| In this path, you can create json file to import the resources from.
62+
| In this path, you can create JSON file to import the resources from.
7763
|
7864
*/
7965
'resource_file_path' => 'resources/laravel-code-generator/sources',
@@ -161,7 +147,7 @@
161147
|--------------------------------------------------------------------------
162148
|
163149
*/
164-
'api_docs_controller_path' => 'Http/Controllers/ApiDocs',
150+
'api_docs_controller_path' => 'Http/Controllers',
165151

166152
/*
167153
|--------------------------------------------------------------------------
@@ -231,15 +217,15 @@
231217

232218
/*
233219
|--------------------------------------------------------------------------
234-
| Patterns to use to generate the html placeholders.
220+
| Patterns to use to generate the HTML placeholders.
235221
|--------------------------------------------------------------------------
236222
|
237223
| When creating the fields, the code generator follows a pattern to generate
238-
| placeholders for the html code. Here you can define which html-types should
224+
| placeholders for the HTML code. Here you can define which html-types should
239225
| the generator create placeholder for. Also, you can define how would you like
240226
| the text to read when no placeholder is assigned.
241227
|
242-
| The follwowing templates can be used to. assuming the field name is owner_name
228+
| The following templates can be used to. assuming the field name is owner_name
243229
| [% field_name %] <=> "owner name"
244230
| [% field_name_sentence %] <=> "Owner name"
245231
| [% field_name_plural %] <=> "owner names"
@@ -268,11 +254,11 @@
268254
| Key phrases that are will be used to determine if a field should have a relation.
269255
|--------------------------------------------------------------------------
270256
|
271-
| When creating resources from existing database, the codegenerator scans
272-
| the field's name for a mattching pattern. When found, these field are considered
257+
| When creating resources from existing database, the code generator scans
258+
| the field's name for a matching pattern. When found, these field are considered
273259
| foreign keys even when the database does not have a foreign constraints.
274260
| Here you can specify patterns to help the generator understand your
275-
| database naming convension.
261+
| database naming conversion.
276262
|
277263
*/
278264
'common_key_patterns' => [
@@ -338,10 +324,23 @@
338324
],
339325
],
340326
[
341-
'match' => ['picture', 'file', 'photo', 'avatar'],
327+
'match' => ['picture', 'photo', 'avatar', 'image'],
328+
'set' => [
329+
'is-on-index' => false,
330+
'html-type' => 'file',
331+
'data-type' => 'string',
332+
'data-type-params' => [255],
333+
'validation' => 'image',
334+
],
335+
],
336+
[
337+
'match' => ['file', 'document', 'attachment*'],
342338
'set' => [
343339
'is-on-index' => false,
344340
'html-type' => 'file',
341+
'data-type' => 'string',
342+
'data-type-params' => [255],
343+
'validation' => 'file',
345344
],
346345
],
347346
[
@@ -373,7 +372,7 @@
373372
],
374373
],
375374
[
376-
'match' => ['created_at', 'updated_at', 'deleted_at'],
375+
'match' => ['created_at', 'updated_at', 'deleted_at', 'modified_at'],
377376
'set' => [
378377
'data-type' => 'datetime',
379378
'is-on-form' => false,
@@ -464,7 +463,7 @@
464463

465464
/*
466465
|--------------------------------------------------------------------------
467-
| A string to postfix the api-resource name with.
466+
| A string to post fix the api-resource name with.
468467
|--------------------------------------------------------------------------
469468
|
470469
| If you don't like to post fix the api-resource with "Resource" you can
@@ -475,7 +474,7 @@
475474

476475
/*
477476
|--------------------------------------------------------------------------
478-
| A string to postfix the collection-api-resource name with.
477+
| A string to post fix the collection-api-resource name with.
479478
|--------------------------------------------------------------------------
480479
|
481480
| If you don't like to post fix the collection-api-resource with "Collection"
@@ -495,7 +494,7 @@
495494

496495
/*
497496
|--------------------------------------------------------------------------
498-
| A string to postfix the form-request name with.
497+
| A string to post fix the form-request name with.
499498
|--------------------------------------------------------------------------
500499
|
501500
| If you don't like to post fix the form-request with "FormRequest" you can
@@ -506,7 +505,7 @@
506505

507506
/*
508507
|--------------------------------------------------------------------------
509-
| Defining non-english or irregular plurals
508+
| Defining non-English or irregular plurals
510509
|--------------------------------------------------------------------------
511510
|
512511
| The code-generator heavily uses Laravel helpers "str_plural()"
@@ -533,10 +532,9 @@
533532
| The "key" of the array is the value to be used in the locale files.
534533
| The "text" key of the sub array, is the string to display in the view or add to the locale files.
535534
| The "template" key of the sub array, is the string to be use in the view for replacement.
536-
| The "in-function-with-collective" key of the sub array, tell the generator that,
537535
| this string would be used in a function or not.
538536
|
539-
| The follwowing templates can be used. Assuming the model name is AssetCategory
537+
| The following templates can be used. Assuming the model name is AssetCategory
540538
| [% model_name %] <=> "asset category"
541539
| [% model_name_sentence %] <=> "Asset category"
542540
| [% model_name_plural %] <=> "asset categories"
@@ -570,7 +568,6 @@
570568
'delete' => [
571569
'text' => 'Delete [% model_name_title %]',
572570
'template' => 'delete_model',
573-
'in-function-with-collective' => true,
574571
],
575572
'edit' => [
576573
'text' => 'Edit [% model_name_title %]',
@@ -587,17 +584,14 @@
587584
'add' => [
588585
'text' => 'Add',
589586
'template' => 'add',
590-
'in-function-with-collective' => true,
591587
],
592588
'update' => [
593589
'text' => 'Update',
594590
'template' => 'update',
595-
'in-function-with-collective' => true,
596591
],
597592
'confirm_delete' => [
598593
'text' => 'Click Ok to delete [% model_name_title %].',
599594
'template' => 'confirm_delete',
600-
'in-function-with-collective' => true,
601595
],
602596
'none_available' => [
603597
'text' => 'No [% model_name_plural_title %] Available.',
@@ -658,7 +652,7 @@
658652
'template' => 'this_parameter_is_an_http_header',
659653
],
660654
'request_was_successful' => [
661-
'text' => 'Request was successfull.',
655+
'text' => 'Request was successfully.',
662656
'template' => 'request_was_successful',
663657
],
664658
'boolean_title' => [
@@ -807,7 +801,7 @@
807801
| Here you can define labels to be used when creating the api-documentation.
808802
| You can define how would you like the text to be generated.
809803
|
810-
| The follwowing templates can be used. Assuming the model name is AssetCategory
804+
| The following templates can be used. Assuming the model name is AssetCategory
811805
| [% model_name %] <=> "asset category"
812806
| [% model_name_sentence %] <=> "Asset category"
813807
| [% model_name_plural %] <=> "asset categories"
@@ -840,12 +834,12 @@
840834
'the_total_of_available_pages' => 'The total of the available pages.',
841835
'store_route_description' => 'Create new [% model_name %].',
842836
'store_route_response_description' => 'The API\'s response will be JSON based data. The JSON object will be structured as follow',
843-
'update_route_description' => 'Update existsing [% model_name %].',
837+
'update_route_description' => 'Update existing [% model_name %].',
844838
'update_route_response_description' => 'The API\'s response will be JSON based data. The JSON object will be structured as follow',
845-
'show_route_description' => 'Retrieve existsing [% model_name %].',
839+
'show_route_description' => 'Retrieve existing [% model_name %].',
846840
'show_route_response_description' => 'The API\'s response will be JSON based data. The JSON object will be structured as follow',
847841
'the_id_of_model_to_retrieve' => 'The unique id of the [% model_name %] to retrieve',
848-
'destroy_route_description' => 'Delete existsing [% model_name %].',
842+
'destroy_route_description' => 'Delete existing [% model_name %].',
849843
'destroy_route_response_description' => 'The API\'s response will be JSON based data. The JSON object will be structured as follow',
850844
'the_id_of_model_to_delete' => 'The id of the [% model_name %] to delete.',
851845
'general_description' => 'Allows you to list, create, edit, show and delete [% model_name_plural %].',
@@ -929,7 +923,7 @@
929923
| Eloquent method to html-type mapping.
930924
|--------------------------------------------------------------------------
931925
|
932-
| This is the mapping used to convert database-column into html field
926+
| This is the mapping used to convert database-column into HTML field
933927
|
934928
*/
935929
'eloquent_type_to_html_type' => [

config/laravel-code-generator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
| CodeGenerator config overrides
88
|--------------------------------------------------------------------------
99
|
10-
| It is a good idea to sperate your configuration form the code-generator's
10+
| It is a good idea to separate your configuration form the code-generator's
1111
| own configuration. This way you won't lose any settings/preference
1212
| you have when upgrading to a new version of the package.
1313
|
1414
| Additionally, you will always know any the configuration difference between
1515
| the default config than your own.
1616
|
17-
| To override the setting that is found in the codegenerator.php file, you'll
17+
| To override the setting that is found in the 'config/default.php' file, you'll
1818
| need to create identical key here with a different value
1919
|
2020
| IMPORTANT: When overriding an option that is an array, the configurations

src/CodeGeneratorServiceProvider.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ public function boot()
2626
$this->publishes([
2727
$dir . 'templates/default' => $this->codeGeneratorBase('templates/default'),
2828
], 'default-template');
29-
30-
// publish the defaultcollective-template
31-
$this->publishes([
32-
$dir . 'templates/default-collective' => $this->codeGeneratorBase('templates/default-collective'),
33-
], 'default-collective-template');
3429
}
3530

3631
/**
@@ -69,7 +64,7 @@ public function register()
6964
'CrestApps\CodeGenerator\Commands\ApiDocs\CreateApiDocsControllerCommand',
7065
'CrestApps\CodeGenerator\Commands\ApiDocs\CreateApiDocsScaffoldCommand',
7166
'CrestApps\CodeGenerator\Commands\ApiDocs\CreateApiDocsViewCommand',
72-
'CrestApps\CodeGenerator\Commands\Resources\ResourceFileFromDatabaseAllCommand'
67+
'CrestApps\CodeGenerator\Commands\Resources\ResourceFileFromDatabaseAllCommand'
7368
];
7469

7570
if (Helpers::isNewerThanOrEqualTo()) {

0 commit comments

Comments
 (0)