15
15
16
16
use function class_exists ;
17
17
use function collect ;
18
+ use Illuminate \Contracts \Config \Repository ;
19
+ use Illuminate \Database \ConnectionResolverInterface ;
20
+ use Illuminate \Database \Console \Factories \FactoryMakeCommand ;
21
+ use Illuminate \Database \Console \Migrations \FreshCommand ;
22
+ use Illuminate \Database \Console \Migrations \InstallCommand ;
23
+ use Illuminate \Database \Console \Migrations \MigrateCommand ;
24
+ use Illuminate \Database \Console \Migrations \MigrateMakeCommand ;
25
+ use Illuminate \Database \Console \Migrations \RefreshCommand ;
26
+ use Illuminate \Database \Console \Migrations \ResetCommand ;
27
+ use Illuminate \Database \Console \Migrations \RollbackCommand ;
28
+ use Illuminate \Database \Console \Migrations \StatusCommand ;
29
+ use Illuminate \Database \Console \Seeds \SeedCommand ;
30
+ use Illuminate \Database \Console \Seeds \SeederMakeCommand ;
31
+ use Illuminate \Database \Console \WipeCommand ;
32
+ use Illuminate \Database \DatabaseServiceProvider ;
18
33
use Illuminate \Database \Migrations \MigrationCreator ;
34
+ use Illuminate \Database \Migrations \MigrationRepositoryInterface ;
35
+ use Illuminate \Database \MigrationServiceProvider ;
36
+ use Illuminate \Foundation \Console \ModelMakeCommand ;
37
+ use Illuminate \Foundation \Providers \ComposerServiceProvider ;
19
38
use Illuminate \Support \Facades \File ;
20
39
use function is_array ;
21
40
use LaravelZero \Framework \Components \AbstractComponentProvider ;
41
+ use SplFileInfo ;
22
42
23
43
/**
24
44
* @internal
@@ -30,7 +50,7 @@ class Provider extends AbstractComponentProvider
30
50
*/
31
51
public function isAvailable (): bool
32
52
{
33
- return class_exists (\ Illuminate \ Database \ DatabaseServiceProvider::class)
53
+ return class_exists (DatabaseServiceProvider::class)
34
54
&& is_array ($ this ->app ['config ' ]->get ('database ' , false ))
35
55
&& $ this ->app ['config ' ]->get ('database.useDefaultProvider ' , true ) === true ;
36
56
}
@@ -57,25 +77,25 @@ public function boot(): void
57
77
if ($ this ->app ->environment () !== 'production ' ) {
58
78
$ this ->commands (
59
79
[
60
- \ Illuminate \ Database \ Console \ Migrations \ MigrateMakeCommand::class,
61
- \ Illuminate \ Database \ Console \ Factories \ FactoryMakeCommand::class,
62
- \ Illuminate \ Database \ Console \ Seeds \ SeederMakeCommand::class,
63
- \ Illuminate \ Foundation \ Console \ ModelMakeCommand::class,
64
- \ Illuminate \ Database \ Console \ Seeds \ SeedCommand::class,
80
+ MigrateMakeCommand::class,
81
+ FactoryMakeCommand::class,
82
+ SeederMakeCommand::class,
83
+ ModelMakeCommand::class,
84
+ SeedCommand::class,
65
85
]
66
86
);
67
87
}
68
88
69
89
$ this ->commands (
70
90
[
71
- \ Illuminate \ Database \ Console \ Migrations \ FreshCommand::class,
72
- \ Illuminate \ Database \ Console \ Migrations \ InstallCommand::class,
73
- \ Illuminate \ Database \ Console \ Migrations \ MigrateCommand::class,
74
- \ Illuminate \ Database \ Console \ Migrations \ RefreshCommand::class,
75
- \ Illuminate \ Database \ Console \ Migrations \ ResetCommand::class,
76
- \ Illuminate \ Database \ Console \ Migrations \ RollbackCommand::class,
77
- \ Illuminate \ Database \ Console \ Migrations \ StatusCommand::class,
78
- \ Illuminate \ Database \ Console \ WipeCommand::class,
91
+ FreshCommand::class,
92
+ InstallCommand::class,
93
+ MigrateCommand::class,
94
+ RefreshCommand::class,
95
+ ResetCommand::class,
96
+ RollbackCommand::class,
97
+ StatusCommand::class,
98
+ WipeCommand::class,
79
99
]
80
100
);
81
101
}
@@ -87,12 +107,12 @@ public function boot(): void
87
107
*/
88
108
protected function registerDatabaseService (): void
89
109
{
90
- $ this ->app ->alias ('db ' , \ Illuminate \ Database \ ConnectionResolverInterface::class);
91
- $ this ->app ->register (\ Illuminate \ Database \ DatabaseServiceProvider::class);
110
+ $ this ->app ->alias ('db ' , ConnectionResolverInterface::class);
111
+ $ this ->app ->register (DatabaseServiceProvider::class);
92
112
93
113
if (File::exists ($ this ->app ->databasePath ('seeders ' ))) {
94
114
collect (File::files ($ this ->app ->databasePath ('seeders ' )))->each (
95
- fn ($ file ) => File::requireOnce ($ file )
115
+ fn (SplFileInfo $ file ) => File::requireOnce (( string ) $ file )
96
116
);
97
117
}
98
118
}
@@ -102,15 +122,17 @@ protected function registerDatabaseService(): void
102
122
*/
103
123
protected function registerMigrationService (): void
104
124
{
125
+ /** @var Repository $config */
105
126
$ config = $ this ->app ['config ' ];
106
127
$ config ->set ('database.migrations ' , $ config ->get ('database.migrations ' ) ?: 'migrations ' );
107
- $ this ->app ->register (\Illuminate \Foundation \Providers \ComposerServiceProvider::class);
108
- $ this ->app ->register (\Illuminate \Database \MigrationServiceProvider::class);
128
+
129
+ $ this ->app ->register (ComposerServiceProvider::class);
130
+ $ this ->app ->register (MigrationServiceProvider::class);
109
131
$ this ->app ->alias ('migration.creator ' , MigrationCreator::class);
110
132
111
133
$ this ->app ->alias (
112
134
'migration.repository ' ,
113
- \ Illuminate \ Database \ Migrations \ MigrationRepositoryInterface::class
135
+ MigrationRepositoryInterface::class
114
136
);
115
137
116
138
$ this ->app ->singleton (
0 commit comments