This repository was archived by the owner on Apr 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ class ServiceGenerator extends Generator
28
28
protected $ directories = [
29
29
'Console/ ' ,
30
30
'database/ ' ,
31
+ 'database/factories/ ' ,
31
32
'database/migrations/ ' ,
32
33
'database/seeds/ ' ,
33
34
'Http/ ' ,
Original file line number Diff line number Diff line change @@ -3,12 +3,35 @@ namespace {{namespace}};
3
3
4
4
use View;
5
5
use Lang;
6
+ use Illuminate\Database\Eloquent\Factory as EloquentFactory;
6
7
use Illuminate\Support\ServiceProvider;
7
8
use {{namespace}}\RouteServiceProvider;
8
9
use Illuminate\Translation\TranslationServiceProvider;
9
10
10
11
class {{name}}ServiceProvider extends ServiceProvider
11
12
{
13
+ /**
14
+ * Bootstrap migrations and factories for:
15
+ * - `php artisan migrate` command.
16
+ * - factory() helper.
17
+ *
18
+ * Previous usage:
19
+ * php artisan migrate --path=src/Services/{{name}}/database/migrations
20
+ * Now:
21
+ * php artisan migrate
22
+ *
23
+ * @return void
24
+ */
25
+ public function boot()
26
+ {
27
+ $this->loadMigrationsFrom([
28
+ realpath(__DIR__ . '/../database/migrations')
29
+ ]);
30
+
31
+ $this->app->make(EloquentFactory::class)
32
+ ->load(realpath(__DIR__ . '/../database/factories'));
33
+ }
34
+
12
35
/**
13
36
* Register the {{name}} service provider.
14
37
*
You can’t perform that action at this time.
0 commit comments