示例#1
0
 public static function feedsID($post_id)
 {
     $ids = array();
     foreach (FeedPost::where('post_id', $post_id)->get() as $record) {
         $ids[] = $record->feed_id;
     }
     return $ids;
 }
示例#2
0
 public function topost($id)
 {
     $post = Post::find($id);
     if ($post) {
         switch ($post->taxonomy_id) {
             case 1:
                 $uri = Post::getFullURI($post->id, true);
                 return Redirect::to($uri);
             case 2:
                 $feed = FeedPost::where('post_id', $post->id)->first();
                 if ($feed) {
                     $page = Post::where('feed_id', $feed->feed_id)->first();
                     if ($page) {
                         $viewmods = WebAPL\Template::getViewMethodList('page');
                         $uri = Post::getFullURI($page->id, true);
                         if (isset($viewmods[$page->view_mod]['support_item']) && $viewmods[$page->view_mod]['support_item']) {
                             $plang = PostLang::where('post_id', $post->id)->where('lang_id', \WebAPL\Language::getId())->first();
                             if ($plang) {
                                 $url = $uri . "?item=" . $plang->uri;
                             } else {
                                 $url = $uri;
                             }
                         } else {
                             $url = $uri;
                         }
                         return Redirect::to($url);
                     } else {
                         throw new Exception("Not found page, post #{$id}");
                     }
                 } else {
                     throw new Exception("Not found feed, post #{$id}");
                 }
                 break;
             default:
                 throw new Exception("Not found taxonomy, post #{$id}");
                 break;
         }
     } else {
         throw new Exception("Post not found #{$id}");
     }
 }
示例#3
0
 public function postDeletefeed()
 {
     $id = Input::get('id');
     Feed::where('id', $id)->delete();
     FeedPost::where('feed_id', $id)->delete();
     FeedRel::where('feed_id', $id)->delete();
     return Redirect::to('feed');
 }