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");
 }
예제 #2
0
파일: Feeds.php 프로젝트: mj1618/punto-cms
 function __construct()
 {
     parent::controllerClass('Feeds');
     parent::headerPlural('Feeds');
     parent::headerSingular('Feed');
     parent::baseRoute('/admin/feeds');
     parent::ajaxBaseRoute('/ajax/admin/feeds');
     parent::table(new Feed());
     parent::attributes([['title' => 'ID', 'id' => 'id'], ['title' => 'Name', 'id' => 'name'], ['title' => 'URL', 'id' => 'url'], ['title' => 'Page', 'id' => 'page.name'], ['title' => 'Section', 'id' => 'section.name']]);
     parent::inputs(function ($row) {
         return ['name' => (new TextBox())->id('name')->label('Name')->defaultValue($row ? $row->name : ''), 'url' => (new TextBox())->id('url')->label('URL')->defaultValue($row ? $row->url : ''), 'page_id' => (new DropDown())->id('page_id')->nullable(false)->label('Page')->idField('id')->nameField('name')->rows(Page::get())->defaultValue($row ? $row->page_id : ''), 'section_id' => (new DropDown())->id('section_id')->nullable(false)->label('Section')->idField('id')->nameField('name')->rows(Section::get())->defaultValue($row ? $row->section_id : '')];
     });
     parent::tableName('feed');
 }
예제 #3
0
 function dataAll()
 {
     return $this->table->where('page_id', '=', Request::route('id1'))->whereIn('section_id', Section::where('single', '=', 0)->lists('id'))->with('section')->get();
 }
예제 #4
0
파일: Page.php 프로젝트: mj1618/punto-cms
 function countPosts($name)
 {
     return Post::where('page_id', '=', $this->id)->whereIn('section_id', Section::where('name', '=', $name)->lists('id'))->count();
 }