/**
  * @param Content $content
  * @return mixed
  */
 public function update(Content $content)
 {
     // Store the content from the configuration form
     $content->params = Input::all();
     $content->save();
     // Redirect to the page where the content is placed on.
     return Redirect::to(Session::get('referer') . '?mode=content');
 }
 /**
  * @param Page $page
  */
 public function onCreateResourcePage(Page $page)
 {
     // Check if there already is content attached to this page.
     // If so, then we don't have to add new content.
     if (Content::wherePageId($page->id)->first()) {
         return;
     }
     $block = Block::whereController($page->controller)->first();
     $section = Section::whereName('content')->first();
     $content = new Content();
     $content->page()->associate($page);
     $content->section()->associate($section);
     if ($block) {
         $content->block()->associate($block);
     } else {
         $content->controller = $page->controller;
     }
     $content->save();
 }
 /**
  * @param Page $page
  */
 public function onCreateWithContent(Page $page)
 {
     // If the page doesn't have a controller, then we can do nothing
     if (!$page->controller || !$page->layout) {
         return;
     }
     // Check if there already is content attached to this page.
     // If so, then we don't have to add new content.
     if (Content::wherePageId($page->id)->first()) {
         return;
     }
     // Get the main content section
     $section = Section::whereName('content')->first();
     // Create the new content
     $content = new Content();
     $content->page()->associate($page);
     $content->section()->associate($section);
     $content->controller = $page->controller;
     $content->save();
 }