|
8 | 8 | [![Quality Score][ico-code-quality]][link-code-quality] |
9 | 9 | [![Total Downloads][ico-downloads]][link-downloads] |
10 | 10 |
|
| 11 | +This is a package developed by us for internal use. It is supposed to help us during development and save plenty of time by automating many steps while creating typical CRUD entities with [Laravel Backpack](https://laravel-backpack.readme.io/docs). You can write your own Services (they have to implement `Webfactor\Laravel\Generators\Contracts\ServiceInterface`) and register them in the `generators.php` config file, or use this package as an inspiration for your own implementation. |
| 12 | + |
11 | 13 | ## Install |
12 | 14 |
|
13 | | -Via Composer |
| 15 | +### Via Composer |
| 16 | + |
| 17 | +This package is indended to be used only for development, not for production. Because of that we recommend to use `require-dev`: |
14 | 18 |
|
15 | 19 | ``` bash |
16 | | -$ composer require webfactor/laravel-generators |
| 20 | +composer require-dev webfactor/laravel-generators |
17 | 21 | ``` |
18 | 22 |
|
19 | 23 | ## Usage |
20 | 24 |
|
21 | 25 | ``` bash |
22 | | -php artisan make:entity {entity_name} |
| 26 | +php artisan make:entity {entity_name} {--schema=} {--ide=} |
23 | 27 | ``` |
24 | 28 |
|
25 | | -Use *singular* for entity. This will automatically create (while respecting naming conventions): |
| 29 | +`--schema` currently uses syntax from [Laravel 5 Extended Generators](https://github.com/laracasts/Laravel-5-Generators-Extended) |
| 30 | + |
| 31 | +Use *singular* for entity. This will automatically create (while respecting our internal naming conventions): |
26 | 32 |
|
27 | 33 | * Migration |
28 | 34 | * Factory |
29 | 35 | * Seeder |
30 | | -* Backpack CRUD (Model, Controller, Request) |
| 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 |
31 | 42 |
|
32 | | -## Change log |
| 43 | +### Open files in IDE |
33 | 44 |
|
34 | | -Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. |
| 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`.` |
35 | 46 |
|
36 | | -## Testing |
| 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) |
37 | 48 |
|
38 | | -``` bash |
39 | | -$ composer test |
| 49 | +Example: |
| 50 | + |
| 51 | +```php |
| 52 | +<?php |
| 53 | + |
| 54 | +class ExampleService extends ServiceAbstract implements ServiceInterface |
| 55 | +{ |
| 56 | + protected $relativeToBasePath = 'path/to/file'; |
| 57 | + |
| 58 | + public function call() |
| 59 | + { |
| 60 | + // do some magic |
| 61 | + |
| 62 | + // searches for latest file (using modified date) in given directory and adds it to the stack |
| 63 | + $this->addLatestFileToIdeStack(); |
| 64 | + } |
| 65 | +} |
40 | 66 | ``` |
41 | 67 |
|
| 68 | +## Adaption |
| 69 | + |
| 70 | +Feel free to write your own Services that fit your purposes! |
| 71 | + |
| 72 | +## Change log |
| 73 | + |
| 74 | +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. |
| 75 | + |
42 | 76 | ## Contributing |
43 | 77 |
|
44 | 78 | Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details. |
|
0 commit comments