getEvent(); DB::query( << $this->amount, 'type' => $this->type, 'id' => $this->event->villageId] ); } public function cancel(): void { $this->dbDelete(); } public function dbInsert(): void { DB::query( 'insert into events (time, village_id) VALUES (:time, :village_id)', ['time' => $this->event->time->format('c'), 'village_id' => $this->event->villageId] ); DB::query( 'insert into events_train_units (event_id, amount, type) VALUES (:event_id, :amount, :type)', ['event_id' => DB::$connection->lastInsertId(), 'amount' => $this->amount, '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]); } }