Skip to content

Commit 12bb811

Browse files
committed
wip
1 parent d1cf7bb commit 12bb811

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"illuminate/database": "^10.0||^11.0||^12.0",
2828
"illuminate/events": "^10.0||^11.0||^12.0",
2929
"illuminate/support": "^10.0||^11.0||^12.0",
30-
"solution-forest/workflow-engine-core": "^0.0.1-alpha",
31-
"spatie/laravel-package-tools": "^1.16"
30+
"solution-forest/workflow-engine-core": "^0.0.1-alpha"
3231
},
3332
"conflict": {
3433
"laravel/framework": "<11.0.0"
@@ -37,6 +36,7 @@
3736
"laravel/pint": "^1.14",
3837
"nunomaduro/collision": "^8.1.1||^7.10.0",
3938
"larastan/larastan": "^2.9||^3.0",
39+
"orchestra/testbench": "^9.0.0|^10.0.0",
4040
"pestphp/pest": "^3.0",
4141
"pestphp/pest-plugin-arch": "^3.0",
4242
"pestphp/pest-plugin-laravel": "^3.0",

src/Providers/WorkflowEngineServiceProvider.php

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,21 @@
33
namespace SolutionForest\WorkflowEngine\Laravel\Providers;
44

55
use Illuminate\Database\DatabaseManager;
6+
use Illuminate\Support\ServiceProvider;
67
use SolutionForest\WorkflowEngine\Contracts\StorageAdapter;
78
use SolutionForest\WorkflowEngine\Core\WorkflowEngine;
89
use SolutionForest\WorkflowEngine\Laravel\Commands\LaravelWorkflowEngineCommand;
910
use SolutionForest\WorkflowEngine\Laravel\Storage\DatabaseStorage;
10-
use Spatie\LaravelPackageTools\Package;
11-
use Spatie\LaravelPackageTools\PackageServiceProvider;
1211

13-
class WorkflowEngineServiceProvider extends PackageServiceProvider
12+
class WorkflowEngineServiceProvider extends ServiceProvider
1413
{
15-
public function configurePackage(Package $package): void
16-
{
17-
/*
18-
* This class is a Package Service Provider
19-
*
20-
* More info: https://github.com/spatie/laravel-package-tools
21-
*/
22-
$package
23-
->name('workflow-engine')
24-
->hasConfigFile()
25-
->hasViews()
26-
->hasMigration('create_workflow_instances_table')
27-
->hasCommand(LaravelWorkflowEngineCommand::class);
28-
}
29-
3014
public function register(): void
3115
{
32-
parent::register();
16+
// Merge config
17+
$this->mergeConfigFrom(
18+
__DIR__.'/../../config/workflow-engine.php',
19+
'workflow-engine'
20+
);
3321

3422
// Register storage adapter
3523
$this->app->singleton(StorageAdapter::class, function ($app): StorageAdapter {
@@ -73,6 +61,32 @@ public function register(): void
7361

7462
public function boot(): void
7563
{
76-
parent::boot();
64+
// Publish config file
65+
if ($this->app->runningInConsole()) {
66+
$this->publishes([
67+
__DIR__.'/../../config/workflow-engine.php' => config_path('workflow-engine.php'),
68+
], 'workflow-engine-config');
69+
}
70+
71+
// Publish migrations
72+
if ($this->app->runningInConsole()) {
73+
$this->publishes([
74+
__DIR__.'/../../database/migrations/create_workflow_instances_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_workflow_instances_table.php'),
75+
], 'workflow-engine-migrations');
76+
}
77+
78+
// Publish views
79+
if ($this->app->runningInConsole()) {
80+
$this->publishes([
81+
__DIR__.'/../../resources/views' => resource_path('views/vendor/workflow-engine'),
82+
], 'workflow-engine-views');
83+
}
84+
85+
// Register commands
86+
if ($this->app->runningInConsole()) {
87+
$this->commands([
88+
LaravelWorkflowEngineCommand::class,
89+
]);
90+
}
7791
}
7892
}

0 commit comments

Comments
 (0)