From fa9096c0ab521aae45cab6c48a54290d14a221b9 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 29 Nov 2023 11:03:15 +0100 Subject: event tables --- src/Model/Event/UpgradeBuilding.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/Model/Event/UpgradeBuilding.php') diff --git a/src/Model/Event/UpgradeBuilding.php b/src/Model/Event/UpgradeBuilding.php index f4f427d..a426a21 100644 --- a/src/Model/Event/UpgradeBuilding.php +++ b/src/Model/Event/UpgradeBuilding.php @@ -7,20 +7,15 @@ use App\Model\Event; class UpgradeBuilding extends BaseEvent { - public Event $event; public string $type; - public function __construct(Event $event, string $type) - { - $this->event = $event; - $this->type = $type; - } - /** * @return void */ public function __invoke(): void { + $this->getEvent(); + DB::query( << $this->event->time->format('c'), 'village_id' => $this->event->villageId] ); DB::query( - 'insert into events_upgrade_building (event_id, type) values (:event_id, :type)', - ['event_id' => DB::$connection->lastInsertId(), $this->type] + 'insert into events_upgrade_building (event_id, type) VALUES (:event_id, :type)', + ['event_id' => DB::$connection->lastInsertId(), 'type' => $this->type] ); } + + public function dbDelete(): void + { + DB::query('delete from events where id=:id', ['id' => $this->eventId]); + DB::query('delete from events_upgrade_building where id=:id', ['id' => $this->id]); + } } -- cgit v1.2.3