hellomoto Posted November 27, 2024 Share Posted November 27, 2024 (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 November 27, 2024 by hellomoto Link to comment Share on other sites More sharing options...
hellomoto Posted November 28, 2024 Author Share Posted November 28, 2024 $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