diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-09-24 13:40:25 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-09-24 13:40:25 +0200 |
commit | fa00b957378a393f8edbfc98ef111d35d18ecb09 (patch) | |
tree | 654e7dc5414f7f2795dbe996d3e1570793a5b1b8 /src/Model/Event/UpgradeBuilding.php |
initial commit
Diffstat (limited to 'src/Model/Event/UpgradeBuilding.php')
-rw-r--r-- | src/Model/Event/UpgradeBuilding.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Model/Event/UpgradeBuilding.php b/src/Model/Event/UpgradeBuilding.php new file mode 100644 index 0000000..c014cfe --- /dev/null +++ b/src/Model/Event/UpgradeBuilding.php @@ -0,0 +1,27 @@ +<?php + +namespace App\Model\Event; + +use App\DB; +use App\Model\Event; + +class UpgradeBuilding extends Event +{ + /** + * @return void + */ + public function __invoke(): void + { + $payload = json_decode($this->payload, true); + + DB::query( + 'update village_buildings set level=level+1 where id=:id', + ['id' => $payload['id']] + ); + + DB::query( + 'delete from events where id=:id', + ['id' => $this->id] + ); + } +} |