hellomoto Posted 4 hours ago Share Posted 4 hours ago (edited) This did not work... $np = new Page(); $np->parent = $page; $np->template = 'upload'; $np->title = 'tmp'; $np->save(); $np->of(false); $np->uploaded->add($f); $np->title = $f->basename;//$t->description; $np->name = $sanitizer->name($np->title); $np->save(); $this->message('Uploaded to new page: '.$np->title); wire('pagefiles')->delete($f); Error: Call to a member function add() on null Edited 4 hours ago by hellomoto Link to comment Share on other sites More sharing options...
hellomoto Posted 2 hours ago Author Share Posted 2 hours ago $np = new Page(); $np->of(false); $np->parent = $page->id; $np->template = $make; $np->title = 'tmp'; $np->addStatus('unpublished'); $np->save(); $np->uploaded->add($f); $np->title = $f->basename; $np->save(); $this->message('Uploaded to new page '.$np->id.': '.$np->title); $page->upload->delete($f); $page->save(['noHooks' => true]); works Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now