public function postChangeStatus() { $page_id = $this->getRequiredParameter('page_id'); $value = $this->getRequiredParameter('value'); $page = Page::find($page_id); $page->update(['status' => $value]); $this->setContent($page->getStatus()); }
public function postReorder() { $pageId = $this->getRequiredParameter('id'); $data = (array) $this->getRequiredParameter('data'); /** @var Page $page */ $page = Page::find($pageId); $widgetsData = []; foreach ($data as $block => $widgets) { foreach ($widgets as $position => $widgetId) { $location = ['block' => $block, 'position' => $position]; $widgetsData[$widgetId] = $location; } } $this->request->merge(['widget' => $widgetsData]); $page->save(); $this->setContent(true); }