summaryrefslogtreecommitdiff
path: root/src/Model/Event/TrainUnits.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-12-02 14:14:34 +0100
committerDaniel Weipert <code@drogueronin.de>2023-12-02 14:14:34 +0100
commite5a243a52b910e35b10b26c06aa8978356b86769 (patch)
tree74ddb82add2f3ea200e9fd11cfedb6c0cace09be /src/Model/Event/TrainUnits.php
parentfa9096c0ab521aae45cab6c48a54290d14a221b9 (diff)
login and events
Diffstat (limited to 'src/Model/Event/TrainUnits.php')
-rw-r--r--src/Model/Event/TrainUnits.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Model/Event/TrainUnits.php b/src/Model/Event/TrainUnits.php
index 5b4eef9..5e77198 100644
--- a/src/Model/Event/TrainUnits.php
+++ b/src/Model/Event/TrainUnits.php
@@ -14,13 +14,13 @@ class TrainUnits extends BaseEvent
*/
public function __invoke(): void
{
- $payload = json_decode($this->payload, true);
+ $this->getEvent();
DB::query(
<<<SQL
insert into village_units (amount, type, is_traveling, home_village_id, residence_village_id)
values (:amount, :type, false, :id, :id)
- on conflict (type, home_village_id, residence_village_id)
+ on conflict (type, home_village_id, residence_village_id, is_traveling)
do update set amount = village_units.amount+:amount
SQL,
['amount' => $this->amount, 'type' => $this->type, 'id' => $this->event->villageId]