From eb1884200b10836b93596393883e9180386af786 Mon Sep 17 00:00:00 2001 From: shibafu Date: Sun, 7 Jan 2018 22:19:33 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=8A=E6=83=A3=E8=8F=9C=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=8A=E3=83=BC=E3=82=92=E4=BD=9C=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Ejaculation.php | 5 + app/Http/Controllers/HomeController.php | 9 +- resources/views/home.blade.php | 120 ++++++++++++++++++------ 3 files changed, 103 insertions(+), 31 deletions(-) diff --git a/app/Ejaculation.php b/app/Ejaculation.php index 8410e48..80fd2b7 100644 --- a/app/Ejaculation.php +++ b/app/Ejaculation.php @@ -17,4 +17,9 @@ class Ejaculation extends Model protected $dates = [ 'ejaculated_date' ]; + + public function user() + { + return $this->belongsTo('App\User'); + } } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 78793a0..859a64f 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -35,7 +35,14 @@ class HomeController extends Controller $categories = Information::CATEGORIES; if (Auth::check()) { - return view('home')->with(compact('informations', 'categories')); + // お惣菜コーナー用のデータ取得 + $publicLinkedEjaculations = Ejaculation::where('is_private', false) + ->where('link', '<>', '') + ->orderBy('ejaculated_date', 'desc') + ->take(5) + ->get(); + + return view('home')->with(compact('informations', 'categories', 'publicLinkedEjaculations')); } else { return view('guest')->with(compact('informations', 'categories')); } diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 4e9aae1..e359d63 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -22,38 +22,98 @@ お知らせ一覧 » -
-
ランキング
-
-

参加しているランキングはありません。自信のあるお題を探して、参加登録してみませんか?

-

参加登録をすると、定期的に集計されてここにあなたの順位が表示されます。

+ @if (!empty($publicLinkedEjaculations)) +
+
お惣菜コーナー
+
+

最近の公開チェックインから、オカズリンク付きのものを表示しています。

+
+
- -
-
-
穴兄弟レーダー
-
-

- あなたがよく使うタグやオカズから、関連していそうなオカズリンクを探して表示しています。 -

-
- -
+ @endif
@endsection + +@push('script') + +@endpush \ No newline at end of file