diff --git a/.gitignore b/.gitignore
index 71e6347..853133f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
/storage/*.key
/storage/database.sqlite
/vendor
+/database/customData
.env
.env.backup
.phpunit.result.cache
@@ -14,6 +15,8 @@ npm-debug.log
yarn-error.log
/.idea
/.vscode
+/composer.json
+/composer.lock
public/vendor
diff --git a/app/Console/Commands/WorkflowSync.php b/app/Console/Commands/WorkflowSync.php
new file mode 100644
index 0000000..e51277d
--- /dev/null
+++ b/app/Console/Commands/WorkflowSync.php
@@ -0,0 +1,89 @@
+ $form_definition['name']],
+ [
+ 'group' => $form_definition['group'],
+ 'description' => $form_definition['description'],
+ 'fields' => $form_definition['fields']
+ ]
+ );
+ fclose(($forms_json_file));
+ }
+ }
+ }
+
+ $workflow_dir = config('workflow.storagePath');
+ $workflow_arr = scandir($workflow_dir);
+ foreach($workflow_arr as $workflow_json_filename)
+ {
+ if($workflow_json_filename != '.' && $workflow_json_filename != '..')
+ {
+ $wf_definition_json = '';
+ $workflow_json_file = fopen($workflow_dir . '/' . $workflow_json_filename,'r');
+ while(true)
+ {
+ $append = fgets($workflow_json_file);
+ if($append == false){break;}
+ $wf_definition_json = $wf_definition_json . $append;
+ }
+ $workflow_def = json_decode($wf_definition_json,true);
+ WorkflowDefinition::updateOrCreate(
+ ['name' => $workflow_def['name']],
+ [
+ 'description' => $workflow_def['description'],
+ 'definition' => $workflow_def,
+ ]
+ );
+ fclose($workflow_json_file);
+ }
+ }
+ }
+}
diff --git a/app/Http/Controllers/WorkflowController.php b/app/Http/Controllers/WorkflowController.php
index 2313646..78947e6 100644
--- a/app/Http/Controllers/WorkflowController.php
+++ b/app/Http/Controllers/WorkflowController.php
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
+use Uspdev\Workflow\Models\WorkflowDefinition;
use Uspdev\Workflow\Workflow;
use Uspdev\Forms\Form;
@@ -147,5 +148,27 @@ public function atendimentos()
return view('userRelatedObjects', compact('workflowsDisplay'));
}
+
+ public function exportDefinition($definitionName)
+ {
+ $file_dir = base_path(config('workflow.storagePath'));
+ if(!is_dir($file_dir))
+ {
+ mkdir($file_dir,0777,true);
+ }
+
+ $file_path = $file_dir . "/$definitionName" . ".json";
+
+ $json_file = fopen($file_path,"w");
+
+ $workflowDef = WorkflowDefinition::where('name',$definitionName)->firstOrFail();
+
+ $json_encoded = json_encode($workflowDef['definition'],JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
+
+ fwrite($json_file,$json_encoded);
+ fclose($json_file);
+
+ return redirect()->route('workflows.list-definitions')->with('alert-success','Workflow exportado com sucesso !');
+ }
}
diff --git a/composer.lock b/composer.lock
index 7440601..02ec384 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "2e412f42d75819bbe3dcec16afa9c463",
+ "content-hash": "4a7223e8006b4f119ed34d188de63941",
"packages": [
{
"name": "brick/math",
@@ -3317,16 +3317,16 @@
},
{
"name": "phpseclib/phpseclib",
- "version": "3.0.47",
+ "version": "3.0.48",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
- "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d"
+ "reference": "64065a5679c50acb886e82c07aa139b0f757bb89"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/9d6ca36a6c2dd434765b1071b2644a1c683b385d",
- "reference": "9d6ca36a6c2dd434765b1071b2644a1c683b385d",
+ "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/64065a5679c50acb886e82c07aa139b0f757bb89",
+ "reference": "64065a5679c50acb886e82c07aa139b0f757bb89",
"shasum": ""
},
"require": {
@@ -3407,7 +3407,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
- "source": "https://github.com/phpseclib/phpseclib/tree/3.0.47"
+ "source": "https://github.com/phpseclib/phpseclib/tree/3.0.48"
},
"funding": [
{
@@ -3423,7 +3423,7 @@
"type": "tidelift"
}
],
- "time": "2025-10-06T01:07:24+00:00"
+ "time": "2025-12-15T11:51:42+00:00"
},
{
"name": "psr/cache",
@@ -3888,16 +3888,16 @@
},
{
"name": "psy/psysh",
- "version": "v0.12.16",
+ "version": "v0.12.18",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
- "reference": "ee6d5028be4774f56c6c2c85ec4e6bc9acfe6b67"
+ "reference": "ddff0ac01beddc251786fe70367cd8bbdb258196"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/bobthecow/psysh/zipball/ee6d5028be4774f56c6c2c85ec4e6bc9acfe6b67",
- "reference": "ee6d5028be4774f56c6c2c85ec4e6bc9acfe6b67",
+ "url": "https://api.github.com/repos/bobthecow/psysh/zipball/ddff0ac01beddc251786fe70367cd8bbdb258196",
+ "reference": "ddff0ac01beddc251786fe70367cd8bbdb258196",
"shasum": ""
},
"require": {
@@ -3961,9 +3961,9 @@
],
"support": {
"issues": "https://github.com/bobthecow/psysh/issues",
- "source": "https://github.com/bobthecow/psysh/tree/v0.12.16"
+ "source": "https://github.com/bobthecow/psysh/tree/v0.12.18"
},
- "time": "2025-12-07T03:39:01+00:00"
+ "time": "2025-12-17T14:35:46+00:00"
},
{
"name": "ralouphie/getallheaders",
@@ -4087,20 +4087,20 @@
},
{
"name": "ramsey/uuid",
- "version": "4.9.1",
+ "version": "4.9.2",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
- "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440"
+ "reference": "8429c78ca35a09f27565311b98101e2826affde0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440",
- "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440",
+ "url": "https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0",
+ "reference": "8429c78ca35a09f27565311b98101e2826affde0",
"shasum": ""
},
"require": {
- "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14",
+ "brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14",
"php": "^8.0",
"ramsey/collection": "^1.2 || ^2.0"
},
@@ -4159,9 +4159,9 @@
],
"support": {
"issues": "https://github.com/ramsey/uuid/issues",
- "source": "https://github.com/ramsey/uuid/tree/4.9.1"
+ "source": "https://github.com/ramsey/uuid/tree/4.9.2"
},
- "time": "2025-09-04T20:59:21+00:00"
+ "time": "2025-12-14T04:43:48+00:00"
},
{
"name": "rap2hpoutre/laravel-log-viewer",
@@ -4723,16 +4723,16 @@
},
{
"name": "spatie/laravel-permission",
- "version": "6.23.0",
+ "version": "6.24.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-permission.git",
- "reference": "9e41247bd512b1e6c229afbc1eb528f7565ae3bb"
+ "reference": "76adb1fc8d07c16a0721c35c4cc330b7a12598d7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/9e41247bd512b1e6c229afbc1eb528f7565ae3bb",
- "reference": "9e41247bd512b1e6c229afbc1eb528f7565ae3bb",
+ "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/76adb1fc8d07c16a0721c35c4cc330b7a12598d7",
+ "reference": "76adb1fc8d07c16a0721c35c4cc330b7a12598d7",
"shasum": ""
},
"require": {
@@ -4794,7 +4794,7 @@
],
"support": {
"issues": "https://github.com/spatie/laravel-permission/issues",
- "source": "https://github.com/spatie/laravel-permission/tree/6.23.0"
+ "source": "https://github.com/spatie/laravel-permission/tree/6.24.0"
},
"funding": [
{
@@ -4802,7 +4802,7 @@
"type": "github"
}
],
- "time": "2025-11-03T20:16:13+00:00"
+ "time": "2025-12-13T21:45:21+00:00"
},
{
"name": "spatie/temporary-directory",
@@ -7382,23 +7382,23 @@
},
{
"name": "tijsverkoyen/css-to-inline-styles",
- "version": "v2.3.0",
+ "version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/tijsverkoyen/CssToInlineStyles.git",
- "reference": "0d72ac1c00084279c1816675284073c5a337c20d"
+ "reference": "f0292ccf0ec75843d65027214426b6b163b48b41"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/0d72ac1c00084279c1816675284073c5a337c20d",
- "reference": "0d72ac1c00084279c1816675284073c5a337c20d",
+ "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/f0292ccf0ec75843d65027214426b6b163b48b41",
+ "reference": "f0292ccf0ec75843d65027214426b6b163b48b41",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"php": "^7.4 || ^8.0",
- "symfony/css-selector": "^5.4 || ^6.0 || ^7.0"
+ "symfony/css-selector": "^5.4 || ^6.0 || ^7.0 || ^8.0"
},
"require-dev": {
"phpstan/phpstan": "^2.0",
@@ -7431,9 +7431,9 @@
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"support": {
"issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues",
- "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.3.0"
+ "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.4.0"
},
- "time": "2024-12-21T16:25:41+00:00"
+ "time": "2025-12-02T11:56:42+00:00"
},
{
"name": "uspdev/cache",
@@ -7789,12 +7789,12 @@
"source": {
"type": "git",
"url": "https://github.com/uspdev/workflow.git",
- "reference": "4b60bd719cb28157f8d3ab4a3dfff9d4d96cf32b"
+ "reference": "b80b88c7e42e79511a5d9e9aaa1dfd890c094dd4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/uspdev/workflow/zipball/4b60bd719cb28157f8d3ab4a3dfff9d4d96cf32b",
- "reference": "4b60bd719cb28157f8d3ab4a3dfff9d4d96cf32b",
+ "url": "https://api.github.com/repos/uspdev/workflow/zipball/b80b88c7e42e79511a5d9e9aaa1dfd890c094dd4",
+ "reference": "b80b88c7e42e79511a5d9e9aaa1dfd890c094dd4",
"shasum": ""
},
"require": {
@@ -7841,7 +7841,7 @@
"issues": "https://github.com/uspdev/workflow/issues",
"source": "https://github.com/uspdev/workflow/tree/master"
},
- "time": "2025-12-09T12:07:50+00:00"
+ "time": "2025-12-10T17:18:27+00:00"
},
{
"name": "vlucas/phpdotenv",
@@ -10814,7 +10814,6 @@
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
- "graphp/graph": 20,
"uspdev/workflow": 20
},
"prefer-stable": true,
@@ -10822,6 +10821,6 @@
"platform": {
"php": "^8.2"
},
- "platform-dev": [],
- "plugin-api-version": "2.3.0"
+ "platform-dev": {},
+ "plugin-api-version": "2.6.0"
}
diff --git a/resources/views/list.blade.php b/resources/views/list.blade.php
index bda5f43..d994a92 100644
--- a/resources/views/list.blade.php
+++ b/resources/views/list.blade.php
@@ -36,6 +36,7 @@ class="d-inline">
+ Exportar workflow
@endforeach
diff --git a/routes/web.php b/routes/web.php
index e18328c..1f59f8b 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -25,6 +25,7 @@
Route::delete('/definition/{definition}', [WorkflowController::class, 'destroyDefinition'])->name('workflows.destroyDefinition');
Route::get('/editdefinition/{definition}', [WorkflowController::class, 'editDefinition'])->name('workflows.editDefinition');
Route::post('/updatedefinition/', [WorkflowController::class, 'updateDefinition'])->name('workflows.updateDefinition');
+ Route::get('/exportdefinition/{definitionName}',[WorkflowController::class,'exportDefinition'])->name('workflows.exportDefinition');
Route::get('/viewcreateobject', [WorkflowController::class, 'viewCreateObject'])->name('workflows.viewCreateObject');
Route::get('/createobject/{definitionName}', [WorkflowController::class, 'createObject'])->name('workflows.createObject');