How to register a hook in nextcloud app

Hello everyone,

I want to create a hook for my custom app on insert/update query

Class {

        public function insert($data){

             "Here is my insert query";

how can i register hook for this?

You can make events available with code like:

if $this->dispatcher is undefined for you, you can use \OC::$server->getEventDispatcher() to get the dispatcher.