I’m using a pagesdisplay section to show a filtered and sorted list of pages in the panel. I’m using this query:
query: page.kitajahr
And this custom page method:
public function kitajahr()
{
$year = date('Y');
if (date('n') < 8) {
$year--;
}
$start = date($year . '-08-01');
$end = date($year + 1 . '-07-31');
return $this->children()
->filterBy('date', '>=', $start)
->filterBy('date', '<=', $end)
->sortBy('date', 'desc');
}
This throws an error in the panel:
Call to a member function
title()
onnull
{"status":"error","exception":"Error","message":"Call to a member function title() on null","file":"site\/models\/meal.php","line":8,"code":500,"route":"pages\/([a-zA-Z0-9\\.\\-_%= \\+\\@\\(\\)
If I remove the sorting it works on the first page. But as soon as I navigate to another but the first page, I get the error again.
Any ideas why this is happening?