Skip to content

Commit 7bf72e5

Browse files
authored
Merge pull request #7 from laravel-workflow/feature/postgres
Use serializer
2 parents ceacd9d + 0133275 commit 7bf72e5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

app/Http/Controllers/WorkflowsController.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use SplFileObject;
66
use Workflow\Models\StoredWorkflow;
7+
use Workflow\Serializers\Y;
78

89
class WorkflowsController extends Controller
910
{
@@ -33,8 +34,15 @@ public function running() {
3334
public function show($id) {
3435
$flow = config('workflows.stored_workflow_model', StoredWorkflow::class)::whereId($id)->with(['exceptions', 'logs'])->first();
3536

37+
$flow->arguments = serialize(Y::unserialize($flow->arguments));
38+
39+
$flow->logs = $flow->logs->map(function ($log) {
40+
$log->result = serialize(Y::unserialize($log->result));
41+
return $log;
42+
});
43+
3644
$flow->exceptions = $flow->exceptions->map(function ($exception) {
37-
$unserialized = unserialize($exception->exception);
45+
$unserialized = Y::unserialize($exception->exception);
3846
if (is_object($unserialized) && method_exists($unserialized, 'getFile')) {
3947
$file = new SplFileObject($unserialized->getFile());
4048
$file->seek($unserialized->getLine() - 4);
@@ -44,10 +52,14 @@ public function show($id) {
4452
if ($file->eof()) break;
4553
}
4654
$exception->code = rtrim($exception->code);
55+
$unserialized->trace = $unserialized->getTrace();
4756
}
57+
$exception->exception = serialize($unserialized);
4858
return $exception;
4959
});
5060

61+
$flow->output = serialize(Y::unserialize($flow->output));
62+
5163
return $flow;
5264
}
5365
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"require": {
1212
"php": "^8.0.2",
13-
"laravel-workflow/laravel-workflow": ">=0.0.11",
13+
"laravel-workflow/laravel-workflow": ">=0.0.19",
1414
"illuminate/support": "^9.0"
1515
},
1616
"require-dev": {

0 commit comments

Comments
 (0)