diff options
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] + ); + } +} |