You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+28-1Lines changed: 28 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,10 +21,37 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
21
21
### Security
22
22
- Nothing
23
23
24
+
## 3.0.0 - 2018-06-24 - Complete Refactoring
25
+
26
+
The Refactoring is supposed to provide new functions more easily in the future.
27
+
28
+
Attention: `schema` has been changed and only registered FieldTypes (see config-file) will be parsed. There are only a few FieldTypes available at the moment, more will come soon.
29
+
30
+
### Added
31
+
32
+
-`AddToGitService`: using `--git` in command will add all files to git
33
+
34
+
### Changed
35
+
36
+
- The parsing of `--schema=""` is now a bit different, but much more powerful. Please see Readme for further information
37
+
- Naming for each service is handled by dedicated classes and can be accessed everywhere (e.g. name of Model inside a CrudController)
38
+
39
+
### Removed
40
+
41
+
- additional commands which are now integrated in the corresponding services
42
+
43
+
## 2.1.0 - 2018-03-30 (for Backpack Base v0.9)
44
+
45
+
### Added
46
+
-`SidebarService` adds an entry to your sidebar
47
+
48
+
### Changed
49
+
-`RouteService` now uses `routes/backpack/custom.php
50
+
24
51
## 2.0.0 - 2018-03-23
25
52
26
53
### Added
27
-
-`LanguageService` generates models.php translation file (if not exists) and fill singular/plural translation
54
+
-`LanguageFileService` generates models.php translation file (if not exists) and fill singular/plural translation
28
55
-`OpenIdeService` opens all generated file with PhpStorm if command is called with `--ide={ide}`
29
56
-`RouteService` adds Backpack Crud route to admin.php
`--schema` currently uses syntax from [Laravel 5 Extended Generators](https://github.com/laracasts/Laravel-5-Generators-Extended) (this will be slightly changed in upcoming v3.0 to provide an extended functionality)
29
+
-`entity_name`: Recommendation: use *singular* for entity. see "[Naming](#naming)" for more information
30
+
-`--schema=`: Here you can provide a [schema-String](#schema)
31
+
-`--migrate`: will automatically call `php artisan migrate` after creating the migration file
32
+
-`--ide=`: will open all files in your prefered [IDE](#open-files-in-ide)
33
+
-`--git`: will add all files to [git](#add-files-to-git)
30
34
31
-
Use *singular* for entity. This will automatically create (while respecting our internal naming conventions):
32
35
33
-
* Migration
34
-
* Factory
35
-
* Seeder
36
-
* Backpack CRUD (modified Backpack Generator):
37
-
* Model (incl. `$fillable`)
38
-
* Request (incl. `rules()`)
39
-
* Controller (incl. CrudColumns and CrudFields, basic for now)
40
-
* Language File
41
-
* Route to Backpack CRUD in admin.php
36
+
If you want to add Services, Naming classes, Field Types, or IDE Opener you have to publish the config-file:
All Services defined in the config file have to implement `Webfactor\Laravel\Generators\Contracts\ServiceInterface` and will then be called in the given order.
45
+
46
+
### Included Services
47
+
48
+
Can be removed or extended by publishing config file:
49
+
50
+
-`MigrationService`
51
+
-`FactoryService`
52
+
-`SeederService`
53
+
- Backpack CRUD:
54
+
-`BackpackCrudModelService` (incl. `$fillable`)
55
+
-`BackpackCrudRequestService` (incl. `rules()`)
56
+
-`BackpackCrudControllerService` (incl. CrudColumns and CrudFields, more coming soon)
57
+
-`SidebarService`
58
+
-`LanguageFileService`
59
+
-`RouteFileService`
60
+
61
+
### Always available (activated by option):
44
62
45
-
With `{--ide=}` option you can define your preferred IDE to open all automatically generated files. This package comes with an implementation for PhpStorm (`Webfactor\Laravel\Generators\Recipes\PhpStormOpener`) which is defined in `generators.php`. The keys in the `ides`-Array are possible values for the command option. You can add other IDE-Opener classes, they have to implement `Webfactor\Laravel\Generators\Contracts\OpenInIdeInterface`.
63
+
-`OpenIdeService`
64
+
-`AddToGitService`
46
65
47
-
In your service class you have to define the path to the file generated by this service. Then add `$this->addLatestFileToIdeStack();` and all files of the stack will be opened by `Webfactor\Laravel\Generators\Services\OpenIdeService` (should be placed at the end of the `services`-array in `generators.php`)
66
+
## Schema
67
+
68
+
The intention of this package concerning Laravel Backpack CRUD is to provide an easy way to define standard Field Types with some default options and override them if necessary.
48
69
49
70
Example:
50
71
51
-
```php
52
-
<?php
72
+
```bash
73
+
php artisan make:entity blog --schema="title:string,text:summernote"
74
+
```
75
+
76
+
This will use the `StringType` and `SummernoteType` classes to create (besides all other files):
77
+
78
+
- Blog.php with `$fillable = ['title', 'text']`
79
+
- BlogRequest.php with predefined rules for each field
80
+
- BlogCrudController.php with columns and fields for `title` and `text`
81
+
82
+
If you want to add/overwrite certain options you can use something like this:
53
83
54
-
class ExampleService extends ServiceAbstract implements ServiceInterface
55
-
{
56
-
protected $relativeToBasePath = 'path/to/file';
84
+
```bash
85
+
php artisan make:entity blog --schema="title:string(unique|default:title);rule(required|min:3|max:64),text:summernote;field(label:Content);column(label:Content)"
86
+
```
87
+
88
+
## Field Types
89
+
90
+
Currently available Field Types (more coming soon):
57
91
58
-
public function call()
59
-
{
60
-
// do some magic
92
+
- Date
93
+
- Number
94
+
- String
95
+
- Summernote (as a proof of concept)
96
+
- Text
61
97
62
-
// searches for latest file (using modified date) in given directory and adds it to the stack
63
-
$this->addLatestFileToIdeStack();
64
-
}
65
-
}
98
+
The available definitions in the Field Type classes currently are:
99
+
100
+
```php
101
+
public $validationRule; // 'required|min:5'...
102
+
103
+
public $migrationField = [
104
+
'type' => 'string', // any type available for a migration file
105
+
// optional:
106
+
// 'unique' => true
107
+
// 'default' => 'value'
108
+
// 'nullable' => true
109
+
// etc.
110
+
];
111
+
112
+
public $crudColumn = [
113
+
'type' => 'text', // or date, number, any backpack column
114
+
// 'label' => 'Name of label'
115
+
// ... any option
116
+
];
117
+
118
+
public $crudField = [
119
+
'type' => 'text', // or date, number, any backpack field
120
+
// 'label' => 'Name of label'
121
+
// ... prefix, suffix... any option
122
+
];
66
123
```
67
124
125
+
## Naming
126
+
127
+
`// to be written`
128
+
129
+
## Add files to git
130
+
131
+
With `{--git}` option all generated files will be added to git automatically. In your service class you have to add the generated file. You can:
132
+
133
+
- use `$this->command->addFile(SplileInfo $file)` or
134
+
- use `$this->addGeneratedFileToIdeStack()` if you use a naming key or
135
+
- use the `Webfactor\Laravel\Generators\Traits\CanGenerateFile` define a naming key and just implement a `buildFileContent()` method
136
+
137
+
## Open files in IDE
138
+
139
+
With `{--ide=}` option you can define your preferred IDE to open all automatically generated files. This package comes with an implementation for PhpStorm (`Webfactor\Laravel\Generators\RecipesPhpStormOpener`) which is defined in `generators.php`. The keys in the `ides`-Array are possible values for the command option. You can add other IDE-Opener classes, they have to implement `Webfactor\Laravel\Generators\Contracts\OpenInIdeInterface`.
140
+
141
+
In your service class you have to add the generated file to a stack (see "Add files to git" section)
142
+
143
+
68
144
## Adaption
69
145
70
146
Feel free to write your own Services that fit your purposes!
0 commit comments