41 lines
1019 B
PHP
41 lines
1019 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()
|
|
{
|
|
// MigrationServiceProvider بهصورت deferred است؛ قبل از override کردن migrate
|
|
// باید migration.repository و migrator ثبت شوند (حتی در package:discover).
|
|
$this->app->register(MigrationServiceProvider::class);
|
|
|
|
$this->app->singleton('command.migrate', function ($app) {
|
|
return new MigrateCommand(
|
|
$app->make('migrator'),
|
|
$app->make(Dispatcher::class)
|
|
);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
//
|
|
}
|
|
}
|