James Cole
2024-01-18 18:57:29 +01:00
parent 7ea112c5e7
commit 09bff5ea4e
3 changed files with 161 additions and 103 deletions

View File

@@ -72,7 +72,7 @@ class RuleTransformer extends AbstractTransformer
'links' => [
[
'rel' => 'self',
'uri' => '/rules/'.$rule->id,
'uri' => '/rules/' . $rule->id,
],
],
];
@@ -109,12 +109,18 @@ class RuleTransformer extends AbstractTransformer
if ('user_action' === $ruleTrigger->trigger_type) {
continue;
}
$triggerValue = (string)$ruleTrigger->trigger_value;
$needsContext = config(sprintf('search.operators.%s.needs_context', $ruleTrigger->trigger_type), true);
if (false === $needsContext) {
$triggerValue = 'true';
}
$result[] = [
'id' => (string)$ruleTrigger->id,
'created_at' => $ruleTrigger->created_at->toAtomString(),
'updated_at' => $ruleTrigger->updated_at->toAtomString(),
'type' => $ruleTrigger->trigger_type,
'value' => $ruleTrigger->trigger_value,
'value' => $triggerValue,
'order' => $ruleTrigger->order,
'active' => $ruleTrigger->active,
'stop_processing' => $ruleTrigger->stop_processing,