wallet handling 4
This commit is contained in:
@@ -1,11 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console;
|
||||||
|
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
use Illuminate\Database\Console\Migrations\MigrateCommand as BaseMigrateCommand;
|
use Illuminate\Database\Console\Migrations\MigrateCommand as BaseMigrateCommand;
|
||||||
use Illuminate\Database\Migrations\Migrator;
|
use Illuminate\Database\Migrations\Migrator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* فقط از طریق AppServiceProvider روی command.migrate ثبت میشود —
|
||||||
|
* داخل Commands/ نباشد تا Kernel آن را auto-load نکند.
|
||||||
|
*/
|
||||||
class MigrateCommand extends BaseMigrateCommand
|
class MigrateCommand extends BaseMigrateCommand
|
||||||
{
|
{
|
||||||
public function __construct(Migrator $migrator, Dispatcher $dispatcher)
|
public function __construct(Migrator $migrator, Dispatcher $dispatcher)
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Console\Commands\MigrateCommand;
|
use App\Console\MigrateCommand;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
use Illuminate\Database\Migrations\MigrationRepositoryInterface;
|
||||||
use Illuminate\Database\MigrationServiceProvider;
|
use Illuminate\Database\MigrationServiceProvider;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
@@ -20,6 +21,10 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
// باید migration.repository و migrator ثبت شوند (حتی در package:discover).
|
// باید migration.repository و migrator ثبت شوند (حتی در package:discover).
|
||||||
$this->app->register(MigrationServiceProvider::class);
|
$this->app->register(MigrationServiceProvider::class);
|
||||||
|
|
||||||
|
$this->app->bind(MigrationRepositoryInterface::class, function ($app) {
|
||||||
|
return $app->make('migration.repository');
|
||||||
|
});
|
||||||
|
|
||||||
$this->app->singleton('command.migrate', function ($app) {
|
$this->app->singleton('command.migrate', function ($app) {
|
||||||
return new MigrateCommand(
|
return new MigrateCommand(
|
||||||
$app->make('migrator'),
|
$app->make('migrator'),
|
||||||
|
|||||||
Reference in New Issue
Block a user