コード例 #1
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param integer $id
  * @param  array $data
  * @return User
  */
 public function update($id, array $data)
 {
     $page = Page::findOrFail($id);
     $page->created_at = new Carbon();
     $page->update(array_only($data, ['title', 'slug', 'is_redirect', 'breadcrumb', 'meta_title', 'meta_keywords', 'meta_description', 'robots', 'parent_id', 'layout_file', 'behavior', 'status', 'published_at', 'redirect_url']));
     return $page;
 }
コード例 #2
0
 public function putPlace()
 {
     $widgetId = (int) $this->getRequiredParameter('widget_id');
     $pageId = (int) $this->getRequiredParameter('page_id');
     $block = $this->getParameter('block', 0);
     DB::table('page_widgets')->insert(['page_id' => $pageId, 'widget_id' => $widgetId, 'block' => $block]);
     $widget = Widget::findOrFail($widgetId);
     $this->setContent(view('widgets::widgets.page.row', ['widget' => $widget->toWidget(), 'block' => $block, 'position' => 500, 'page' => Page::findOrFail($pageId)]));
     $this->setMessage('Widget added to page');
 }
コード例 #3
0
 /**
  * @param integer $id
  * @return Page
  * @throws HttpResponseException
  */
 protected function getPage($id)
 {
     try {
         return Page::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         $this->throwFailException($this->smartRedirect()->withErrors(trans('pages::core.messages.not_found')));
     }
 }