Actions
5 years ago
Contracts
5 years ago
Controllers
5 years ago
Exceptions
5 years ago
MigrationsRegister.php
5 years ago
MigrationsRunner.php
5 years ago
MigrationsServiceProvider.php
5 years ago
MigrationsServiceProvider.php
33 lines
| 1 | <?php |
| 2 | namespace Give\Framework\Migrations; |
| 3 | |
| 4 | use Give\Framework\Migrations\Controllers\ManualMigration; |
| 5 | use Give\Framework\Migrations\MigrationsRunner; |
| 6 | use Give\ServiceProviders\ServiceProvider; |
| 7 | use Give\Helpers\Hooks; |
| 8 | |
| 9 | /** |
| 10 | * Class DatabaseServiceProvider |
| 11 | * @package Give\Framework\Migrations |
| 12 | * |
| 13 | * @since 2.9.0 |
| 14 | */ |
| 15 | class MigrationsServiceProvider implements ServiceProvider { |
| 16 | /** |
| 17 | * @inheritdoc |
| 18 | */ |
| 19 | public function register() { |
| 20 | give()->singleton( MigrationsRunner::class ); |
| 21 | give()->singleton( MigrationsRegister::class ); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * @inheritdoc |
| 26 | */ |
| 27 | public function boot() { |
| 28 | Hooks::addAction( 'admin_init', ManualMigration::class, '__invoke', 0 ); |
| 29 | Hooks::addAction( 'admin_init', MigrationsRunner::class, 'run', 0 ); |
| 30 | Hooks::addAction( 'give_upgrades', MigrationsRunner::class, 'run', 0 ); |
| 31 | } |
| 32 | } |
| 33 |