diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-01-11 13:15:02 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-01-11 13:15:02 +0100 |
commit | 09caff2b2a06d1f8ac8203567035a21c612165f9 (patch) | |
tree | 999be04ff0a418a33e438be9befc8c9297e383f4 /src/Model/Event/SendUnits.php | |
parent | 6301f63bd348109b8693a922f02e16d49205a8fd (diff) |
send resources
Diffstat (limited to 'src/Model/Event/SendUnits.php')
-rw-r--r-- | src/Model/Event/SendUnits.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Model/Event/SendUnits.php b/src/Model/Event/SendUnits.php index ed4d5b6..c9afd6e 100644 --- a/src/Model/Event/SendUnits.php +++ b/src/Model/Event/SendUnits.php @@ -102,6 +102,27 @@ class SendUnits extends BaseEvent ); } + public function cancel(): void + { + $this->event = $this->getEvent(); + + $cancelTimeDiff = $this->event->createdAt->diff(new \DateTime()); + $cancelTime = (new \DateTime())->add($cancelTimeDiff); + + $this->isCanceled = true; + $this->home = $this->destination; + $this->residence = $this->source; + + DB::query( + 'update events set time=:time where id=:id', + ['time' => $cancelTime->format('c'), 'id' => $this->event->id] + ); + DB::query( + 'update events_send_units set is_canceled=:is_canceled, home=:home, residence=:residence where id=:id', + ['is_canceled' => $this->isCanceled, 'home' => $this->home, 'residence' => $this->residence, 'id' => $this->id] + ); + } + public function dbInsert(): void { DB::query( |