|
2 | 2 |
|
3 | 3 | namespace SolutionForest\WorkflowEngine\Laravel\Providers; |
4 | 4 |
|
5 | | -use Illuminate\Contracts\Events\Dispatcher as EventDispatcher; |
6 | 5 | use Illuminate\Database\DatabaseManager; |
7 | | -use SolutionForest\WorkflowEngine\Laravel\Commands\LaravelWorkflowEngineCommand; |
8 | 6 | use SolutionForest\WorkflowEngine\Contracts\StorageAdapter; |
9 | 7 | use SolutionForest\WorkflowEngine\Core\WorkflowEngine; |
| 8 | +use SolutionForest\WorkflowEngine\Laravel\Commands\LaravelWorkflowEngineCommand; |
10 | 9 | use SolutionForest\WorkflowEngine\Laravel\Storage\DatabaseStorage; |
11 | 10 | use Spatie\LaravelPackageTools\Package; |
12 | 11 | use Spatie\LaravelPackageTools\PackageServiceProvider; |
@@ -45,11 +44,25 @@ public function register(): void |
45 | 44 | }; |
46 | 45 | }); |
47 | 46 |
|
| 47 | + // Register event dispatcher adapter |
| 48 | + $this->app->singleton(\SolutionForest\WorkflowEngine\Contracts\EventDispatcher::class, function ($app) { |
| 49 | + return new \SolutionForest\WorkflowEngine\Laravel\Adapters\LaravelEventDispatcher( |
| 50 | + $app->make(\Illuminate\Contracts\Events\Dispatcher::class) |
| 51 | + ); |
| 52 | + }); |
| 53 | + |
| 54 | + // Register logger adapter |
| 55 | + $this->app->singleton(\SolutionForest\WorkflowEngine\Contracts\Logger::class, function ($app) { |
| 56 | + return new \SolutionForest\WorkflowEngine\Laravel\Adapters\LaravelLogger( |
| 57 | + $app->make(\Illuminate\Log\LogManager::class) |
| 58 | + ); |
| 59 | + }); |
| 60 | + |
48 | 61 | // Register workflow engine |
49 | 62 | $this->app->singleton(WorkflowEngine::class, function ($app): WorkflowEngine { |
50 | 63 | return new WorkflowEngine( |
51 | 64 | $app->make(StorageAdapter::class), |
52 | | - $app->make(EventDispatcher::class) |
| 65 | + $app->make(\SolutionForest\WorkflowEngine\Contracts\EventDispatcher::class) |
53 | 66 | ); |
54 | 67 | }); |
55 | 68 |
|
|
0 commit comments