public function handle() { DB::transaction(function () { foreach ($this->sequences as $sequence => $pageId) { $page = PageFacade::find($pageId); // Only update the sequence of pages which are children of this page. if ($this->parent->isParentOf($page)) { $page->setSequence($sequence); PageFacade::save($page); } } }); }