Commit d7cf1a29 by Bagus Pambudi
parents e5b1b302 e77b160c
......@@ -7,11 +7,9 @@ class RssFeedNewController extends Controller
public function feed()
{
$setting = webprofilesetting();
// $posts = Posts::where('post_status', 't')->
// orderBy('post_date', 'desc')->
// limit(10)->get();
$posts = Posts::orderBy('created_at')->get();
$data = response()->view('rss.feed', compact('posts','setting'))->header('Content-Type', 'application/xml');
return strip_tags($data);
$posts = Posts::where('post_status', 't')->
orderBy('post_date', 'desc')->
limit(30)->get();
return $data = response()->view('rss.feednew', compact('posts','setting'))->header('Content-Type', 'application/xml');
}
}
<?=
'<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL
?>
<rss version="2.0">
<channel>
<title>RSS {{$setting['web_title']}}</title>
<link>{{ url('') }}></link>
<description>RSS {{$setting['web_title']}}></description>
<language>{{ $setting['default_language'] }}</language>
<copyright>{{$setting['web_title']}}</copyright>
<lastBuildDate>{{ now() }}</lastBuildDate>
<generator>feed_domain ({{ $setting['email'] }})</generator>
@foreach($posts as $post)
<item>
<id>{{ $post->id }}</id>
<title>{{ $post->title }}</title>
<description>{{ strip_tags(($post->content)) }}</description>
<link>{{ url('post/'.$post['slug'])}}</link>
<pubDate>{{ $post->post_date }}</pubDate>
<image>{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $post->thumbnail }}</image>
<guid isPermaLink="false">{{ url('post/'.$post['slug']) }}</guid>
<kategori>{{ $post->rCategory->name }}</kategori>
<views>{{ $post->viewer }}</views>
</item>
@endforeach
</channel>
</rss>
......@@ -23,3 +23,4 @@ Route::post('/change-language', 'TranslateController@changeLocale')->name('langu
Route::get('/home', 'HomeController@index')->name('home');
Route::get('rss', 'RssFeedController@feed');
Route::get('rssnew', 'RssFeedNewController@feed');
// Route::get('cekrss', 'CekRssFeedController@cekRss');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment