2026-01-24 14:03:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
2026-06-15 15:06:34 +03:30
|
|
|
use App\Console\MigrateCommand;
|
2026-06-15 14:59:52 +03:30
|
|
|
use Illuminate\Contracts\Events\Dispatcher;
|
2026-06-15 15:06:34 +03:30
|
|
|
use Illuminate\Database\Migrations\MigrationRepositoryInterface;
|
2026-06-15 14:59:52 +03:30
|
|
|
use Illuminate\Database\MigrationServiceProvider;
|
2026-01-24 14:03:11 +00:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Register any application services.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function register()
|
|
|
|
|
{
|
2026-06-15 15:02:50 +03:30
|
|
|
// MigrationServiceProvider بهصورت deferred است؛ قبل از override کردن migrate
|
|
|
|
|
// باید migration.repository و migrator ثبت شوند (حتی در package:discover).
|
|
|
|
|
$this->app->register(MigrationServiceProvider::class);
|
|
|
|
|
|
2026-06-15 15:06:34 +03:30
|
|
|
$this->app->bind(MigrationRepositoryInterface::class, function ($app) {
|
|
|
|
|
return $app->make('migration.repository');
|
|
|
|
|
});
|
|
|
|
|
|
2026-06-15 15:02:50 +03:30
|
|
|
$this->app->singleton('command.migrate', function ($app) {
|
|
|
|
|
return new MigrateCommand(
|
|
|
|
|
$app->make('migrator'),
|
|
|
|
|
$app->make(Dispatcher::class)
|
|
|
|
|
);
|
|
|
|
|
});
|
2026-01-24 14:03:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Bootstrap any application services.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function boot()
|
|
|
|
|
{
|
2026-06-15 15:02:50 +03:30
|
|
|
//
|
2026-01-24 14:03:11 +00:00
|
|
|
}
|
|
|
|
|
}
|