I have a pages section called steps.
This works:
dump( $tour->steps()->toPages() );
Kirby\Cms\Pages Object
(
[0] => exhibitions/sammlung-graf/einleitung
[1] => exhibitions/sammlung-graf/dreschflegel
[2] => exhibitions/sammlung-graf/manfred-graf
)
This works, too:
foreach ($tour->steps()->toPages() as $step) {
dump($step->url());
}
Also this works:
dump( $tour->steps()->toPages()->first() );
Kirby\Cms\Page Object
(
[children] => Kirby\Cms\Pages Object
(
)
...
But this throws an error:
dump( $tour->steps()->toPages()->first()->url() );
Call to a member function url() on null
I don’t get it?! What am I missing?