コード例 #1
0
ファイル: Page.php プロジェクト: mj1618/punto-cms
 function copy($name, $desc, $url)
 {
     $page = new Page();
     $page->name = $name;
     $page->description = $desc;
     $page->url = $url;
     $page->template_id = $this->template_id;
     $page->save();
     foreach ($this->posts()->get() as $oldPost) {
         $post = new Post();
         $post->page_id = $page->id;
         $post->section_id = $oldPost->section_id;
         $post->name = $oldPost->name;
         $post->save();
         foreach ($oldPost->contents()->get() as $oldContent) {
             $content = new Content();
             $content->value = $oldContent->value;
             $content->post_id = $post->id;
             $content->item_id = $oldContent->item_id;
             $content->save();
         }
         foreach ($oldPost->attachments()->get() as $oldAttachment) {
             $attachment = new Attachment();
             $attachment->value = $oldAttachment->value;
             $attachment->name = $oldAttachment->name;
             $attachment->post_id = $post->id;
             $attachment->item_type_id = $oldAttachment->item_type_id;
             $attachment->save();
         }
     }
     return $page;
 }
コード例 #2
0
 function post()
 {
     $att = Attachment::find(Request::route('id3'));
     $pageId = Request::route('id1');
     $att->delete();
     return Redirect::to("/admin/manage-pages/{$pageId}/content");
 }
コード例 #3
0
 function download()
 {
     $att = Attachment::find(Request::route("id2"));
     return response()->download("{$att->value}");
 }
コード例 #4
0
 function currentAttachment()
 {
     $attId = Request::route('id3');
     if (isset($attId)) {
         return Attachment::find($attId);
     } else {
         return null;
     }
 }