From ddc09863b304105f116b9bcac8b5090224b5d281 Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Thu, 5 Dec 2024 15:42:14 -0400 Subject: [PATCH] Fix sort in script executor --- .../Http/Controllers/Api/ScriptExecutorController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ProcessMaker/Http/Controllers/Api/ScriptExecutorController.php b/ProcessMaker/Http/Controllers/Api/ScriptExecutorController.php index e625ac01d8..db4d8794fe 100644 --- a/ProcessMaker/Http/Controllers/Api/ScriptExecutorController.php +++ b/ProcessMaker/Http/Controllers/Api/ScriptExecutorController.php @@ -59,7 +59,15 @@ public function index(Request $request) { $this->checkAuth($request); - return new ApiCollection(ScriptExecutor::nonSystem()->get()); + $query = ScriptExecutor::nonSystem(); + + if ($request->has('order_by')) { + $order_by = $request->input('order_by'); + $order_direction = $request->input('order_direction', 'ASC'); + $query->orderBy($order_by, $order_direction); + } + + return new ApiCollection($query->get()); } /**