Skip to content

Commit c5a840c

Browse files
committed
[EH] update readme
1 parent 4f73bf0 commit c5a840c

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

README.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,58 @@ $ composer require-dev webfactor/laravel-generators
2121
## Usage
2222

2323
``` bash
24-
php artisan make:entity {entity_name} {--schema=} {}
24+
php artisan make:entity {entity_name} {--schema=} {--ide=}
2525
```
2626

27-
Use *singular* for entity. This will automatically create (while respecting naming conventions):
27+
Use *singular* for entity. This will automatically create (while respecting our internal naming conventions):
2828

2929
* Migration
3030
* Factory
3131
* Seeder
32-
* Backpack CRUD (Model, Controller, Request)
32+
* Backpack CRUD (modified Backpack Generator):
33+
* Model
34+
* Request
35+
* Controller
36+
* Language File
37+
* Route to Backpack CRUD in admin.php
38+
39+
### Open files in IDE
40+
41+
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`.`
42+
43+
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)
44+
45+
```php
46+
<?php
47+
48+
namespace Webfactor\Laravel\Generators\Services;
49+
50+
use Webfactor\Laravel\Generators\Contracts\ServiceAbstract;
51+
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
52+
53+
class SeederService extends ServiceAbstract implements ServiceInterface
54+
{
55+
protected $relativeToBasePath = 'database/seeds';
56+
57+
public function call()
58+
{
59+
$this->command->call('make:seeder', [
60+
'name' => $this->getName($this->command->entity),
61+
]);
62+
63+
$this->addLatestFileToIdeStack();
64+
}
65+
66+
public function getName(string $entity): string
67+
{
68+
return ucfirst(str_plural($entity)) . 'TableSeeder';
69+
}
70+
}
71+
```
72+
73+
## Adaption
74+
75+
Feel free to write your own Services that fit your purposes!
3376

3477
## Change log
3578

0 commit comments

Comments
 (0)