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