Files
boursecu_server/app/Providers/AppServiceProvider.php
T
2026-06-15 15:06:34 +03:30

46 lines
1.2 KiB
PHP

<?php
namespace App\Providers;
use App\Console\MigrateCommand;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\Migrations\MigrationRepositoryInterface;
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->bind(MigrationRepositoryInterface::class, function ($app) {
return $app->make('migration.repository');
});
$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()
{
//
}
}