45 lines
958 B
PHP
45 lines
958 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Console\Commands\MigrateCommand;
|
|
use Illuminate\Contracts\Events\Dispatcher;
|
|
use Illuminate\Database\MigrationServiceProvider;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
if (! $this->app->runningInConsole()) {
|
|
return;
|
|
}
|
|
|
|
$this->app->extend('command.migrate', function ($command, $app) {
|
|
if (! $app->bound('migrator')) {
|
|
(new MigrationServiceProvider($app))->register();
|
|
}
|
|
|
|
return new MigrateCommand(
|
|
$app->make('migrator'),
|
|
$app->make(Dispatcher::class)
|
|
);
|
|
});
|
|
}
|
|
}
|