Virtual pages (database) page:delete hook not working

Hi,

when i delete a virtual page page.delete:before hook it is not working

   'page.delete:before' => function ($page) {
            // your code goes here
    
            $user = kirby()->user();

      $created = Db::insert('log',[
        'slug' => round(microtime(true) * 1000),
        'status' => 'listed',
        'fecha' => date("Y-m-d H:i:s"),
        'slug_id' => $page->title(),
        'puid' => $page->id(),
        'tipo' => $page->intendedTemplate(),
        'accion' => 'delete',
        'usuario' => $user,
        

      ]);
  },

the same insert statement on delete method works fine

 public function delete(bool $force = false): bool
   {
                    $user = kirby()->user();

      $created = Db::insert('log',[
        'slug' => round(microtime(true) * 1000),
        'status' => 'listed',
        'fecha' => date("Y-m-d H:i:s"),
        'slug_id' => $this->title(),
        'puid' => $this->id(),
        'tipo' => $this->intendedTemplate(),
        'accion' => 'delete',
        'usuario' => $user,
        

      ]);
       return Db::delete('datos', ['slug' => $this->slug()]);
   }

Your delete() method is a page model, right? But it doesn’t trigger any hooks like the overwritten method, so that can’t possibly work.

you are right. my mistake. thanks!!! can you delete this post?

I could but others might run into the same issue and then this post might be helpful. So let’s keep this here.