"Pages::factory" creates returns error message

Hi there,
I want to create content from database and for this I followed the instruction in the guide.

<?php

class SeminarsPage extends Kirby\Cms\Page
{
  public function children()
  {
    $seminars = [];

    foreach (Db::select("seminars") as $seminar) {
      $seminars[] = [
        "slug" => $seminar->slug(),
        "num" => 0,
        "template" => "seminar",
        "model" => "seminar",
        "content" => [
          "title" => $seminar->sem_title_de(),
          "teaser" => $seminar->sem_teaser_de(),
        ],
      ];
    }
    return Pages::factory($seminar, $this);
  }
}

But in the panel I get this error message:

Der Bereich “seminare” konnte nicht geladen werden: Argument 1 passed to Kirby\Cms\Pages::factory() must be of the type array, object given, called in /Users/takikiometzis/code/rci/site/models/seminars.php on line 21

When I check in the template same code widthout Pages::factory… but with
dump(gettype($seminars)) it returns Array

You have a typo: Should be $seminars not $seminar as first parameter

1 Like

My God, that simple?!? Sorry for disturbing you on saturday for this.