Reviewed-on: http://git.076.ne.jp:3000/TechnicalSuwako/076server/pulls/18
このコミットが含まれているのは:
コミット
2358319b5d
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class RssFeedController extends Controller {
|
||||||
|
public function feed () {
|
||||||
|
$select = ['id', 'user_id', 'title', 'slug', 'publish_date', 'message'];
|
||||||
|
$posts = DB::table('blg_content')->select($select)->where('isPost', true)->where('public_status', 0)->orderBy('id', 'desc')->limit(50)->get();
|
||||||
|
|
||||||
|
foreach ($posts as $k => $v) {
|
||||||
|
$userd = DB::table('users')->where('id', $v->user_id)->first();
|
||||||
|
$userd = DB::table('usr_profile')->where('user_id', $v->user_id)->first();
|
||||||
|
$v->user = $userd->display_name;
|
||||||
|
unset($posts[$k]->user_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->view('rss.feed', ['posts' => $posts])->header('Content-Type', 'application/xml');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?=
|
||||||
|
'<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL
|
||||||
|
?>
|
||||||
|
<rss version="2.0">
|
||||||
|
<channel>
|
||||||
|
<title><![CDATA[{{ env('APP_NAME') }}]]></title>
|
||||||
|
<link><![CDATA[{{ env('APP_URL') }}/feed ]]></link>
|
||||||
|
<description><![CDATA[ テクニカル諏訪子のホームページです。ゲーム及びテクノロジー関係ブログですわ♡ ]]></description>
|
||||||
|
<language>ja</language>
|
||||||
|
<pubDate>{{ now() }}</pubDate>
|
||||||
|
|
||||||
|
@foreach($posts as $post)
|
||||||
|
<item>
|
||||||
|
<title><![CDATA[{{ $post->title }}]]></title>
|
||||||
|
<link>{{ env('APP_URL') }}/blog/{{ $post->slug }}</link>
|
||||||
|
<description><![CDATA[{!! $post->message !!}]]></description>
|
||||||
|
<author><![CDATA[{{ $post->user }}]]></author>
|
||||||
|
<pubDate>{{ date('Y-m-d H:i:s', $post->publish_date) }}</pubDate>
|
||||||
|
</item>
|
||||||
|
@endforeach
|
||||||
|
</channel>
|
||||||
|
</rss>
|
|
@ -4,6 +4,7 @@
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item"><a class="nav-link{{ (str_contains($_SERVER['REQUEST_URI'], '/blog') || $_SERVER['REQUEST_URI'] == '/' ? ' active' : '') }}" href="/">{{ __('site.top') }}</a></li>
|
<li class="nav-item"><a class="nav-link{{ (str_contains($_SERVER['REQUEST_URI'], '/blog') || $_SERVER['REQUEST_URI'] == '/' ? ' active' : '') }}" href="/">{{ __('site.top') }}</a></li>
|
||||||
<li class="nav-item"><a class="nav-link" href="http://{{ env('ONION_HOST') }}">Tor</a></li>
|
<li class="nav-item"><a class="nav-link" href="http://{{ env('ONION_HOST') }}">Tor</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="/feed">RSS</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="navbar-nav ml-auto">
|
<ul class="navbar-nav ml-auto">
|
||||||
@if ($user)
|
@if ($user)
|
||||||
|
|
|
@ -34,5 +34,6 @@ Route::get('/memberlist', 'User\MemberList@index');
|
||||||
Route::get('/commentlist', 'Home\CommentList@index');
|
Route::get('/commentlist', 'Home\CommentList@index');
|
||||||
Route::get('/contact/seiko', 'Home\Contact@seiko');
|
Route::get('/contact/seiko', 'Home\Contact@seiko');
|
||||||
Route::any('/contact', 'Home\Contact@index');
|
Route::any('/contact', 'Home\Contact@index');
|
||||||
|
Route::get('/feed', 'RssFeedController@feed');
|
||||||
|
|
||||||
Route::get('/{slug}', 'Home\Index@page');
|
Route::get('/{slug}', 'Home\Index@page');
|
||||||
|
|
新しいイシューから参照