From 69f619e2af8ad6006b07e0c042cbc102e48c38c3 Mon Sep 17 00:00:00 2001 From: shibafu Date: Fri, 5 Jan 2018 22:27:16 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=83=83=E3=83=97=E3=81=AB=E3=81=8A=E7=9F=A5=E3=82=89?= =?UTF-8?q?=E3=81=9B=E3=82=92=E7=BD=AE=E3=81=84=E3=81=A6=E3=81=BF=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/HomeController.php | 16 ++++++++-------- resources/views/guest.blade.php | 9 +++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 46216cc..78793a0 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -27,17 +27,17 @@ class HomeController extends Controller */ public function index() { - if (Auth::check()) { - $informations = Information::query() - ->select('id', 'category', 'pinned', 'title', 'created_at') - ->orderByDesc('pinned') - ->orderByDesc('created_at') - ->paginate(3); - $categories = Information::CATEGORIES; + $informations = Information::query() + ->select('id', 'category', 'pinned', 'title', 'created_at') + ->orderByDesc('pinned') + ->orderByDesc('created_at') + ->paginate(3); + $categories = Information::CATEGORIES; + if (Auth::check()) { return view('home')->with(compact('informations', 'categories')); } else { - return view('guest'); + return view('guest')->with(compact('informations', 'categories')); } } } diff --git a/resources/views/guest.blade.php b/resources/views/guest.blade.php index e1319cf..fb670f0 100644 --- a/resources/views/guest.blade.php +++ b/resources/views/guest.blade.php @@ -27,5 +27,14 @@

ティッシュが蒸発するような人気のオカズや、底なしの体力を競い合うランキングなど、Webならではのサービスも用意していますしたいですね。

+

お知らせ

+
+ @foreach($informations as $info) + + {{ $categories[$info->category]['label'] }} {{ $info->title }} - {{ $info->created_at->format('n月j日') }} + + @endforeach + お知らせ一覧 » +
@endsection