public function createTreeAfterInsert(Event $e) { $tree = new Tree(['name' => 'Главная страница', 'site_code' => $this->code]); if (!$tree->save(false)) { throw new Exception('Failed to create a section of the tree'); } }