Add To Structure not working

I use the addToStructure function to update a page. This works fine but strangely only on the desktop PC, not on the cell phone. This seems totally illogical to me. Can anyone explain this? There are also no error messages due to the exception.

  function addToStructureNew($page, $field, $data = array()){
      $fieldData = page($page)->$field()->yaml();
      $fieldData[] = $data;
      $fieldData = yaml::encode($fieldData);
      try {
        page($page)->update(array($field => $fieldData));
        return true;
      } catch(Exception $e) {
        return $e->getMessage();
      }
    }
    
    addToStructureNew($page, 'archiv',[
      'datum' => date('d.m.Y'),
      'uhrzeit' => date('G:i:s')
    ]);

Are you logged in on the phone or are you authenticating this call otherwise? Can’t tell from this little bit of code.

That was already the solution … thanks for the tip! I forgot that you have to authenticate to edit the page. A simple $kirby->impersonate('kirby'); has already solved the whole thing! Frohe Weihnachten :christmas_tree: