/**
  * @return mixed
  */
 public function rss()
 {
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel(array('title' => \Config::get('laravel-blog.meta.rss_feed.title'), 'description' => \Config::get('laravel-blog.meta.rss_feed.description'), 'link' => \URL::current()));
     $posts = $this->post->live()->where($this->post->getTable() . '.in_rss', '=', true)->orderBy($this->post->getTable() . '.published_date', 'desc')->take(10)->get();
     foreach ($posts as $post) {
         $feed->item(array('title' => $post->title, 'description' => $post->summary, 'link' => \URL::action('\\Fbf\\LaravelBlog\\PostsController@view', array('slug' => $post->slug))));
     }
     return \Response::make($feed, 200, array('Content-Type', 'application/rss+xml'));
 }
Beispiel #2
0
 /**
  * Feed function
  */
 public function feed()
 {
     $topics = Topic::excellent()->recent()->limit(20)->get();
     $channel = ['title' => 'phphub++ - Business Forum', 'description' => 'Opportunity business goal driven forum', 'link' => URL::route('feed')];
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel($channel);
     foreach ($topics as $topic) {
         $feed->item(['title' => $topic->title, 'description|cdata' => str_limit($topic->body, 200), 'link' => URL::route('topics.show', $topic->id), 'pubDate' => date('Y-m-d', strtotime($topic->created_at))]);
     }
     return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
 }
 /**
  * Feed function
  */
 public function feed()
 {
     $topics = Topic::excellent()->recent()->limit(20)->get();
     $channel = ['title' => 'PHPhub - PHP & Laravel的中文社区', 'description' => 'PHPhub是 PHP 和 Laravel 的中文社区,在这里我们讨论技术, 分享技术。', 'link' => URL::route('feed')];
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel($channel);
     foreach ($topics as $topic) {
         $feed->item(['title' => $topic->title, 'description|cdata' => str_limit($topic->body, 200), 'link' => URL::route('topics.show', $topic->id), 'pubDate' => date('Y-m-d', strtotime($topic->created_at))]);
     }
     return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
 }
Beispiel #4
0
 /**
  * Feed function
  */
 public function feed()
 {
     $topics = Topic::excellent()->recent()->limit(20)->get();
     $channel = ['title' => 'Laravel 台灣 - 討論 PHP 與 Laravel 的好所在', 'description' => 'PHP 和 Laravel 的中文社群,在這裡我們討論技術, 分享技術。', 'link' => URL::route('feed')];
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel($channel);
     foreach ($topics as $topic) {
         $feed->item(['title' => $topic->title, 'description|cdata' => str_limit($topic->body, 200), 'link' => URL::route('topics.show', $topic->id)]);
     }
     return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
 }
Beispiel #5
0
 private function makeChannel($title, $desc, $link)
 {
     $feed = Rss::feed('2.0', 'UTF-8');
     return $feed->channel(array('title' => $title, 'description' => $desc, 'link' => $link));
 }
 public function feed()
 {
     $posts = Post::recent()->limit(20)->get();
     $channel = ['title' => 'Laravel Blog', 'description' => 'Happy Bloging', 'link' => URL::route('feed')];
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel($channel);
     foreach ($posts as $post) {
         $feed->item(['title' => $post->title, 'description|cdata' => str_limit($post->body, 200), 'link' => URL::route('posts.show', $post->id)]);
     }
     return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
 }
Beispiel #7
0
 /**
  * Feed function
  */
 public function feed()
 {
     $topics = Topic::excellent()->recent()->limit(20)->get();
     $channel = ['title' => 'Pingju - 评论汇集的应用', 'description' => '评聚是一个为您汇聚感兴趣的咨询以及评论的网络应用', 'link' => URL::route('feed')];
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel($channel);
     foreach ($topics as $topic) {
         $feed->item(['title' => $topic->title, 'description|cdata' => str_limit($topic->body, 200), 'link' => URL::route('topics.show', $topic->id), 'pubDate' => date('Y-m-d', strtotime($topic->created_at))]);
     }
     return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
 }
Beispiel #8
0
    // is automatically limited to 160 characters
    OpenGraph::addImage('addImage.png');
    return View::make('hello');
});
// Sitemap
Route::get('sitemap', function () {
    $posts = DB::table('iumslas')->orderBy('created_at', 'desc')->get();
    foreach ($posts as $post) {
        $element = array('location' => "/sitemap-posts.xml", 'last_modified' => $post->created_at, 'change_frequency' => 'weekly', 'priority' => '0.90');
        SEOSitemap::addRaw($element);
    }
    return Response::make(SEOSitemap::generate(), 200, array('Content-Type' => 'text/xml'));
});
//RSS
Route::get('/rss', function () {
    $feed = Rss::feed('2.0', 'UTF-8');
    $feed->channel(array('title' => 'Channel\'s title', 'description' => 'Channel\'s description', 'link' => 'http://www.test.com/'));
    for ($i = 1; $i <= 5; $i++) {
        $feed->item(array('title' => 'Item ' . $i, 'description|cdata' => 'Description ' . $i, 'link' => 'http://www.test.com/article-' . $i));
    }
    return Response::make($feed, 200, array('Content-Type' => 'text/xml'));
});
//Slug
Route::get('/slug', function () {
    $post = new Post(['title' => 'My Awesome Blog Post']);
    $post = new Post(['title' => 'öçşiğü-ajhsgd*.asdkjy21ı3uydjsa']);
    $post->save();
});
//Tag
Route::get("/tag", function () {
    $data = Input::only('title', 'body', 'category_id');