try {
// we store registrations as subpages of the current pageincrement(string $field, int $by = 1, int $max = null)
$countries = $page->update([
**'daystoarrive' => page($data['title'])->increment('daystoarrive', $by = $data['daystoarrive']),**
'orders' => page($data['title'])->increment('orders'),
]);
I’m having an error with this, highlighted by ** ** the code works if the page title is a single word, for example; australia, however when the page title is more than one word, for example, united states, it’ll throw up this error.
Not sure why it won’t work on a page title of multiple words.
That doesn’t make sense, you can’t call the increment() method inside your update method. Increment first, then when that’s done, update the page with the values from those pages.
Also, do not call a class method without checking if an instance of the class exists, first.