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
+16-1Lines changed: 16 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,24 @@ 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-XX
24
+
## 3.0.0 - 2018-06-24 - Complete Refactoring
25
25
26
+
The Refactoring is supposed to provide new functions more easily in the future.
26
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
All Services defined in the config file have to implement `Webfactor\Laravel\Generators\Contracts\ServiceInterface` and will then be called in the given order.
44
+
45
+
### Included Services
46
+
47
+
Can be removed or extended by publishing config file:
48
+
49
+
-`MigrationService`
50
+
-`FactoryService`
51
+
-`SeederService`
52
+
- Backpack CRUD:
53
+
-`BackpackCrudModelService` (incl. `$fillable`)
54
+
-`BackpackCrudRequestService` (incl. `rules()`)
55
+
-`BackpackCrudControllerService` (incl. CrudColumns and CrudFields, more coming soon)
56
+
-`SidebarService`
57
+
-`LanguageFileService`
58
+
-`RouteFileService`
59
+
60
+
### Always available (activated by option):
42
61
43
-
### Open files in IDE
62
+
-`OpenIdeService`
63
+
-`AddToGitService`
44
64
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\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`.`
65
+
## Schema
46
66
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`.
67
+
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
68
49
69
Example:
50
70
51
-
```php
52
-
<?php
71
+
```bash
72
+
php artisan make:entity blog --schema="title:string,text:summernote"
73
+
```
74
+
75
+
This will use the `StringType` and `SummernoteType` classes to create (besides all other files):
53
76
54
-
class ExampleService extends ServiceAbstract implements ServiceInterface
55
-
{
56
-
protected $relativeToBasePath = 'path/to/file';
77
+
- Blog.php with `$fillable = ['title', 'text']`
78
+
- BlogRequest.php with predefined rules for each field
79
+
- BlogCrudController.php with columns and fields for `title` and `text`
57
80
58
-
public function call()
59
-
{
60
-
// do some magic
81
+
If you want to add/overwrite certain options you can use something like this:
61
82
62
-
// searches for latest file (using modified date) in given directory and adds it to the stack
63
-
$this->addLatestFileToIdeStack();
64
-
}
65
-
}
83
+
```bash
84
+
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)"
66
85
```
67
86
87
+
## Field Types
88
+
89
+
Currently available Field Types (more coming soon):
90
+
91
+
- Date
92
+
- Number
93
+
- String
94
+
- Summernote (as a proof of concept)
95
+
- Text
96
+
97
+
The available definitions in the Field Type classes currently are:
98
+
99
+
```php
100
+
public $validationRule; // 'required|min:5'...
101
+
102
+
public $migrationField = [
103
+
'type' => 'string', // any type available for a migration file
104
+
// optional:
105
+
// 'unique' => true
106
+
// 'default' => 'value'
107
+
// 'nullable' => true
108
+
// etc.
109
+
];
110
+
111
+
public $crudColumn = [
112
+
'type' => 'text', // or date, number, any backpack column
113
+
// 'label' => 'Name of label'
114
+
// ... any option
115
+
];
116
+
117
+
public $crudField = [
118
+
'type' => 'text', // or date, number, any backpack field
119
+
// 'label' => 'Name of label'
120
+
// ... prefix, suffix... any option
121
+
];
122
+
```
123
+
124
+
## Naming
125
+
126
+
`// to be written`
127
+
128
+
## Add files to git
129
+
130
+
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:
131
+
132
+
- use `$this->command->addFile(SplileInfo $file)` or
133
+
- use `$this->addGeneratedFileToIdeStack()` if you use a naming key or
134
+
- use the `Webfactor\Laravel\Generators\Traits\CanGenerateFile` define a naming key and just implement a `buildFileContent()` method
135
+
136
+
## Open files in IDE
137
+
138
+
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`.
139
+
140
+
In your service class you have to add the generated file to a stack (see "Add files to git" section)
141
+
142
+
68
143
## Adaption
69
144
70
145
Feel free to write your own Services that fit your purposes!
0 commit comments