diff --git a/app/Http/Controllers/Admin/InfoController.php b/app/Http/Controllers/Admin/InfoController.php new file mode 100644 index 0000000..6a1c7c7 --- /dev/null +++ b/app/Http/Controllers/Admin/InfoController.php @@ -0,0 +1,44 @@ +select('id', 'category', 'pinned', 'title', 'created_at') + ->orderByDesc('pinned') + ->orderByDesc('created_at') + ->paginate(20); + + return view('admin.info.index')->with([ + 'informations' => $informations, + 'categories' => Information::CATEGORIES + ]); + } + + public function create() + { + // TODO + } + + public function edit($id) + { + $information = Information::findOrFail($id); + + return view('admin.info.edit')->with([ + 'info' => $information, + 'categories' => Information::CATEGORIES + ]); + } + + public function update(Request $request) + { + // TODO + } +} diff --git a/resources/views/admin/info/edit.blade.php b/resources/views/admin/info/edit.blade.php new file mode 100644 index 0000000..ff3e588 --- /dev/null +++ b/resources/views/admin/info/edit.blade.php @@ -0,0 +1,48 @@ +@extends('layouts.admin') + +@section('title', 'お知らせ') + +@section('tab-content') +
カテゴリ | +タイトル | +作成日 | +
---|---|---|
+ @if ($info->pinned) + ピン留め + @endif + {{ $categories[$info->category]['label'] }} + | ++ {{ $info->title }} + | ++ {{ $info->created_at->format('Y年n月j日') }} + | +