Skip to content

Commit acca3fe

Browse files
committed
Merge branch 'main' into develop
2 parents 0638ef3 + 370115e commit acca3fe

File tree

8 files changed

+83
-13
lines changed

8 files changed

+83
-13
lines changed

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
- name: Dependabot metadata
1616
id: metadata
17-
uses: dependabot/fetch-metadata@v2.2.0
17+
uses: dependabot/fetch-metadata@v2.4.0
1818
with:
1919
github-token: "${{ secrets.GITHUB_TOKEN }}"
2020

.github/workflows/fix-php-code-style-issues.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919
with:
2020
ref: ${{ github.head_ref }}
2121

2222
- name: Fix PHP code style issues
23-
uses: aglipanci/laravel-pint-action@2.4
23+
uses: aglipanci/laravel-pint-action@2.6
2424

2525
- name: Commit changes
26-
uses: stefanzweifel/git-auto-commit-action@v5
26+
uses: stefanzweifel/git-auto-commit-action@v6
2727
with:
2828
commit_message: Fix styling

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
timeout-minutes: 5
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717

1818
- name: Setup PHP
1919
uses: shivammathur/setup-php@v2

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
steps:
3636
- name: Checkout code
37-
uses: actions/checkout@v4
37+
uses: actions/checkout@v5
3838

3939
- name: Setup PHP
4040
uses: shivammathur/setup-php@v2

.github/workflows/update-changelog.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v5
1818
with:
1919
ref: main
2020

@@ -25,7 +25,7 @@ jobs:
2525
release-notes: ${{ github.event.release.body }}
2626

2727
- name: Commit updated CHANGELOG
28-
uses: stefanzweifel/git-auto-commit-action@v5
28+
uses: stefanzweifel/git-auto-commit-action@v6
2929
with:
3030
branch: main
3131
commit_message: Update CHANGELOG

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
# Changelog
22

33
All notable changes to `laravel-workflow-loader` will be documented in this file.
4+
5+
## v0.1.2 - 2024-09-26
6+
7+
### What's Changed
8+
9+
* Fixed: if migration not run before publishing service provider, run m… by @soap in https://github.com/soap/laravel-workflow-loader/pull/12
10+
11+
**Full Changelog**: https://github.com/soap/laravel-workflow-loader/compare/v0.1.1...v0.1.2
12+
13+
## v0.1.1 - 2024-09-25
14+
15+
### What's Changed
16+
17+
* Add fromStatesName attribute to display from states by @soap in https://github.com/soap/laravel-workflow-loader/pull/11
18+
19+
**Full Changelog**: https://github.com/soap/laravel-workflow-loader/compare/v0.1.0...v0.1.1
20+
21+
## v0.1.0 - 2024-09-19
22+
23+
### What's Changed
24+
25+
* Develop by @soap in https://github.com/soap/laravel-workflow-loader/pull/10
26+
27+
**Full Changelog**: https://github.com/soap/laravel-workflow-loader/compare/v0.0.11...v0.1.0

README.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
This package extends [zerodahero/laravel-workflow](https://github.com/zerodahero/laravel-workflow) by adding option to store workflow configuration in database. Laravel workflow only support loading configuration form Laravel configuration. This package provides user to change workflow configuration without helping from developers.
1010

1111
## Support us
12-
12+
You can suggest for any approvement, sponsor this project or make a pull request. I am happy to consider any recommendation. I am not a good programmer so my design may not be the best one. My background is not computer programming. I am an Electrical engineer.
1313

1414
## Installation
1515

@@ -36,17 +36,63 @@ This is the contents of the published config file:
3636

3737
```php
3838
return [
39+
'loaders' => [
40+
'database' => [
41+
'tableNames' => [
42+
'workflows' => 'workflows',
43+
'workflow_states' => 'workflow_states',
44+
'workflow_transitions' => 'workflow_transitions',
45+
'workflow_state_transitions' => 'workflow_state_transitions',
46+
],
47+
'class' => \Soap\WorkflowLoader\DatabaseLoader::class,
48+
],
49+
],
3950
];
4051
```
4152

53+
To use this package to load workflow configuration from database, you need to register workflow service provider provided by the package. Zerodahero 's workflow registry will be used to load configuration retreiving from database.
54+
```
55+
php artisan venodr:publish --tag="workflow-loader-provider"
56+
```
4257

43-
## Usage
44-
45-
To use this package to store workflow configuration you need to register workflow binding in your application service provider. You have to instruct Laravel to use new 'workflow' binding instead of the one provided by zerodahero/laravel-workflow.
58+
This will copy the following WorkflowServiceProvider.php to application providers folder, ensure that it was included in application bootstrap. The following is the content of the file.
4659

4760
```php
4861

62+
namespace App\Providers;
63+
64+
use Illuminate\Support\ServiceProvider;
65+
66+
class WorkflowServiceProvider extends ServiceProvider
67+
{
68+
public function register() {}
69+
70+
public function boot()
71+
{
72+
$registry = app()->make('workflow');
73+
$workflowLoaderRegistry = app()->make('workflowLoaderRegistry');
74+
foreach ($workflowLoaderRegistry->all() as $workflow => $config) {
75+
$registry->addFromArray($workflow, $config);
76+
}
77+
}
78+
}
79+
```
80+
This package doesnot provide user interface for user to manage workflow configuration. By design it should be in separate package. I have a plan to create filament plugin to handle this.
81+
82+
## Usage
83+
After you have completed setup, create workflow configuration in database using your own way or provided by other package. Then use them like the one you use by zerohadero/laravel-workflow. Storing configuration in database is easy to develop workflow for user.
84+
85+
## To Do
86+
Curently guards should be created via event subscriber. I have a plan to use Symfony expression as upper guard layer. For example, you can write;
87+
88+
```
89+
guard => $subject.isWaitingFor($user) || !$subject.isOwnedBy($user)
90+
```
91+
or
92+
```
93+
guard => $subject.isApprovers($user) || $subject.isReviewers($user)
4994
```
95+
Then the package will inject $subject and $user for you and use Symfony expression to evaluate blocking of the transition.
5096

5197
## Testing
5298

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": "^8.2",
2020
"illuminate/contracts": "^10.0||^11.0",
2121
"spatie/laravel-package-tools": "^1.16",
22-
"zerodahero/laravel-workflow": "^4.0|^5.0"
22+
"zerodahero/laravel-workflow": "^6.0.0"
2323
},
2424
"require-dev": {
2525
"laravel/pint": "^1.14",

0 commit comments

Comments
 (0)