Controller for Virtual Page

Hi, I have created a virtual page with:

Page::factory([
  'slug' => $slug,
  'template' => 'profile',
  'content' => [
    'author' => $email,
  ]
]);

I need to load a Controller for this page.
Would be nice something like:

'controller' => 'profile',

It’s possible in any way?
Thanks.

The controller should be picked up automatically when it is present when the template is called. If your controller is in a plugin, it has to be registered.

1 Like

Thanks, you’re right I was doing it bad!