会員へのお知らせ追加 #30
52
app/Http/Controllers/UserInformationController.php
Normal file
52
app/Http/Controllers/UserInformationController.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?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();
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
return view('user_information.history', [
|
||||||
|
'user_name' => $user_name, // ユーザー名(ヘッダー用)
|
||||||
|
'informations' => $informations
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
37
resources/views/user_information/history.blade.php
Normal file
37
resources/views/user_information/history.blade.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<main>
|
||||||
|
<header class="alert alert-success">
|
||||||
|
<h4 class="container">お知らせ > 過去のお知らせ</h4>
|
||||||
|
</header>
|
||||||
|
<section id="" class="container mt30 mb50">
|
||||||
|
<div class="col-12 col-md-8 offset-0 offset-md-2 mb30">
|
||||||
|
<h3 class="text-center alert-success">お知らせ一覧</h3>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
@forelse($informations as $information)
|
||||||
|
<div class="col-12 col-md-3 offset-0 offset-md-2">
|
||||||
|
<h5 class="text-success">
|
||||||
|
{{ \Carbon\Carbon::parse($information->entry_date)->format('Y年n月j日') }}
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-7 mb10">
|
||||||
|
<p class="h5 font-weight-normal">
|
||||||
|
{{ $information->user_information_history }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<div class="col-12 text-center py-5">
|
||||||
|
<p>過去のお知らせはありません。</p>
|
||||||
|
</div>
|
||||||
|
@endforelse
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-center mt-4">
|
||||||
|
{{ $informations->links('partials.paging') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-6 offset-0 offset-md-3 mt-4 mb50">
|
||||||
|
<a href="{{ url('mypage') }}" class="btn btn-lg btn-block btn-outline-success">マイページへ戻る</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
@endsection
|
||||||
38
resources/views/user_information/index.blade.php
Normal file
38
resources/views/user_information/index.blade.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<main>
|
||||||
|
<header class="alert alert-success">
|
||||||
|
<h4 class="container">お知らせ > お知らせ一覧</h4>
|
||||||
|
</header>
|
||||||
|
<section id="" class="container mt30 mb50">
|
||||||
|
<div class="col-12 col-md-8 offset-0 offset-md-2 mb30">
|
||||||
|
<h3 class="text-center alert-success">お知らせ一覧</h3>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
@forelse($informations as $information)
|
||||||
|
<div class="col-12 col-md-3 offset-0 offset-md-2">
|
||||||
|
<h5 class="text-success">
|
||||||
|
{{ \Carbon\Carbon::parse($information->entry_date)->format('Y年n月j日') }}
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-7 mb10">
|
||||||
|
<p class="h5 font-weight-normal">
|
||||||
|
{{ $information->user_information_history }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
@empty
|
||||||
|
<div class="col-12 text-center py-5">
|
||||||
|
<p>お知らせはありません。</p>
|
||||||
|
</div>
|
||||||
|
@endforelse
|
||||||
|
|
||||||
|
<div class="col-12 col-md-5 offset-md-1 mt10">
|
||||||
|
<a href="{{ url('mypage') }}" class="btn btn-lg btn-block btn-outline-success">マイページへ戻る</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-5 mt10">
|
||||||
|
<a href="{{ url('user_information/history') }}" class="btn btn-lg btn-block btn-outline-success">過去のお知らせ</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
@endsection
|
||||||
@ -22,6 +22,7 @@ use App\Http\Controllers\ParkingSearchController;
|
|||||||
use App\Http\Controllers\ParkWaitlistController;
|
use App\Http\Controllers\ParkWaitlistController;
|
||||||
use App\Http\Controllers\ReceiptController;
|
use App\Http\Controllers\ReceiptController;
|
||||||
use App\Http\Controllers\ParkDetailController;
|
use App\Http\Controllers\ParkDetailController;
|
||||||
|
use App\Http\Controllers\UserInformationController;
|
||||||
|
|
||||||
// 画面遷移のみ
|
// 画面遷移のみ
|
||||||
Route::get('/', function () { return view('general.swo1_1'); })->name('swo1_1');
|
Route::get('/', function () { return view('general.swo1_1'); })->name('swo1_1');
|
||||||
@ -133,6 +134,10 @@ Route::get('park_search', [RegularContractCreateController::class, 'show'])->nam
|
|||||||
// 空き待ち状況確認
|
// 空き待ち状況確認
|
||||||
Route::get('park_waitlist', [ParkWaitlistController::class, 'index'])->name('park_waitlist.index');
|
Route::get('park_waitlist', [ParkWaitlistController::class, 'index'])->name('park_waitlist.index');
|
||||||
|
|
||||||
|
// 会員へのお知らせ
|
||||||
|
Route::get('/user_information', [UserInformationController::class, 'index'])->name('user_information.index');
|
||||||
|
Route::get('/user_information/history', [UserInformationController::class, 'history'])->name('user_information.history');
|
||||||
|
|
||||||
// ウェルネット決済画面(仮)
|
// ウェルネット決済画面(仮)
|
||||||
Route::get('/wellnet/payment', function (): mixed {
|
Route::get('/wellnet/payment', function (): mixed {
|
||||||
$html = <<<HTML
|
$html = <<<HTML
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user