Jump to content

Recommended Posts

Posted

Hello,

I'm trying to create a page via api and populate values to it. I can populate everything except user pages to a page reference array.

Code: 

$dataUsers = $data->project->users;
  foreach($dataUsers as $dataUser) {
    $newProject->projectUsers->add(wire()->pages->find('template=user, id=' . $dataUser->id));
  }

I'm receiving my data via JSON.

Is there something I'm missing?

Thanks for help

Posted

Users are not typical pages, so you should use wire()->users->find() instead. Or, alternatively, you can use wire()->pages->find('template=user, id=..., check_access=0').

  • Like 3

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...