+
+ /**
+ * Deletes one or more hook records
+ *
+ * We have to clear the cached routerDispatchData because addons can provide routes
+ *
+ * @param array $condition
+ * @param array $options
+ * @return bool
+ * @throws \Exception
+ */
+ public static function delete(array $condition, array $options = [])
+ {
+ $result = DBA::delete('hook', $condition, $options);
+
+ if ($result) {
+ DI::cache()->delete('routerDispatchData');
+ }
+
+ return $result;
+ }
+
+ /**
+ * Inserts a hook record
+ *
+ * We have to clear the cached routerDispatchData because addons can provide routes
+ *
+ * @param array $condition
+ * @return bool
+ * @throws \Exception
+ */
+ private static function insert(array $condition)
+ {
+ $result = DBA::insert('hook', $condition);
+
+ if ($result) {
+ DI::cache()->delete('routerDispatchData');
+ }
+
+ return $result;
+ }