function getViewViews()
 {
     if (Item::find(Request::route("id" . $this->level))->itemType()->get()->first()->short_name === 'dropdown') {
         return [(new TemplateSectionItemValues())->showAllView()];
     } else {
         return [];
     }
 }
Example #2
0
 function post()
 {
     //        $ref = Request::header("referrer");
     foreach ($this->definition()["Inputs"] as $input) {
         $item = Item::find($input->id);
         $content = $item->content()->where('post_id', '=', Request::route('id2'))->get()->first();
         if (isset($content) === false) {
             $content = new Content();
             $content->item_id = $item->id;
             $content->post_id = Request::route('id2');
             $input->insert($content, Input::get("{$item->id}"));
         } else {
             $input->update($content, Input::get("{$item->id}"));
         }
         //            $content->value = Input::get("$item->id");
         $content->save();
     }
     return Redirect::to("/admin/edit-pages/" . Request::route("id1") . "/view");
 }
 function post()
 {
     $pageId = Request::route('id1');
     $sectionId = Request::route('id2');
     $section = Section::find($sectionId);
     $inputs = $this->inputs();
     $post = new Post();
     $post->page_id = $pageId;
     $post->section_id = $sectionId;
     $post->name = $section->name;
     $post->description = $section->description;
     $post->save();
     foreach ($inputs as $input) {
         $item = Item::find($input->id);
         $content = null;
         if (isset($content) === false) {
             $content = new Content();
             $content->item_id = $item->id;
             $content->post_id = $post->id;
             $input->insert($content, Input::get("{$item->id}"));
         }
         //            else {
         //                $input->update($content, Input::get("$item->id"));
         //            }
         $content->save();
     }
     return Redirect::to("/admin/manage-pages/{$pageId}/content");
 }
 function post()
 {
     $post = Post::find(Request::route('id2'));
     $pageId = Request::route('id1');
     $sectionId = $post->section()->first()->id;
     $inputs = $this->inputs(Post::find(Request::route('id2')));
     foreach ($inputs as $input) {
         $item = Item::find($input->id);
         $content = $item->content()->where('post_id', '=', $post->id)->get()->first();
         if (isset($content) === false) {
             $content = new Content();
             $content->item_id = $item->id;
             $content->post_id = $post->id;
             $input->insert($content, Input::get("{$item->id}"));
         } else {
             $input->update($content, Input::get("{$item->id}"));
         }
         $content->save();
     }
     return Redirect::to("/admin/manage-pages/{$pageId}/content");
 }