Skip to content

Commit bf78573

Browse files
authored
Merge pull request #9 from soap/develop
Update database loader and workflow loader
2 parents bb3aa01 + a35e670 commit bf78573

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/Repositories/WorkflowRepository.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ public function __construct(Workflow $model)
1616
public function all()
1717
{
1818
$workflows = $this->model->with(['transitions', 'states'])->get();
19+
$config = collect([]);
20+
foreach ($workflows as $workflow) {
21+
$config = $config->merge($this->makeWorkflowCofig($workflow));
22+
}
1923

20-
return $workflows->map(function ($workflow) {
21-
return $this->makeWorkflowCofig($workflow);
22-
})->toArray();
24+
return $config->toArray();
2325
}
2426

2527
public function find($id)

src/WorkflowLoader.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ public function all(): array
3131
return [];
3232
}
3333

34-
return collect($this->loaders)->mapWithKeys(function ($loader) {
35-
return [$loader::class => $loader->all()];
36-
})->toArray();
34+
$workflows = collect([]);
35+
foreach ($this->loaders as $loader) {
36+
$workflows = $workflows->merge(collect($loader->all()));
37+
}
38+
39+
return $workflows->toArray();
3740
}
3841
}

0 commit comments

Comments
 (0)