61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Http\Request;
|
|
|
|
class UserInformationController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$user_id = session('user_id');
|
|
if (!$user_id) {
|
|
return redirect('/login');
|
|
}
|
|
$user_name = DB::table('user')->where('user_id', $user_id)->value('user_name');
|
|
|
|
// お知らせデータ取得
|
|
$informations = DB::table('user_information_history')
|
|
->where('user_id', $user_id)
|
|
->orderByDesc('user_information_history_id')
|
|
->select('entry_date', 'user_information_history')
|
|
->limit(10)
|
|
->get();
|
|
|
|
\Log::info('お知らせ画面にアクセス', [
|
|
'user_id' => $user_id,
|
|
]);
|
|
|
|
return view('user_information.index', [
|
|
'user_name' => $user_name, // ユーザー名(ヘッダー用)
|
|
'informations' => $informations
|
|
]);
|
|
}
|
|
|
|
public function history()
|
|
{
|
|
$user_id = session('user_id');
|
|
if (!$user_id) {
|
|
return redirect('/login');
|
|
}
|
|
$user_name = DB::table('user')->where('user_id', $user_id)->value('user_name');
|
|
|
|
// お知らせデータ取得(全件)
|
|
$informations = DB::table('user_information_history')
|
|
->where('user_id', $user_id)
|
|
->orderByDesc('user_information_history_id')
|
|
->select('entry_date', 'user_information_history')
|
|
->paginate(10);
|
|
|
|
\Log::info('過去のお知らせ画面にアクセス', [
|
|
'user_id' => $user_id,
|
|
]);
|
|
|
|
return view('user_information.history', [
|
|
'user_name' => $user_name, // ユーザー名(ヘッダー用)
|
|
'informations' => $informations
|
|
]);
|
|
}
|
|
}
|