質問編集履歴

3

view画面変更

2022/07/15 02:39

投稿

hntake
hntake

スコア9

test CHANGED
File without changes
test CHANGED
@@ -62,6 +62,40 @@
62
62
  </div>
63
63
  </div>
64
64
  </div>
65
+
66
+ <!--検索結果テーブル 検索された時のみ表示する-->
67
+ @if (!empty($users))
68
+ <div class="test-hover">
69
+ <p>全{{ $users->count() }}件</p>
70
+ <table class="table table-hover">
71
+ <thead style="background-color: #ffd900">
72
+ <tr>
73
+ <th style="width:20%">生徒名</th>
74
+ <th style="width:10%">学年</th>
75
+ <th style="width:20%">テスト履歴表示へ</th>
76
+ </tr>
77
+ </thead>
78
+ @foreach($users as $user)
79
+ <tr>
80
+ <td>{{ $user->name }}</td>
81
+ <td>{{$user->year }}</td>
82
+ <td ><div class="button"><a href="{{ route('id_view',['id'=>$user->id]) }}">表示</a></div></td>
83
+ </tr>
84
+ @endforeach
85
+ </table>
86
+ </div>
87
+ <!--テーブルここまで-->
88
+ <!--ページネーション-->
89
+ <div class="d-flex justify-content-center">
90
+ {{-- appendsでカテゴリを選択したまま遷移 --}}
91
+ {{ $users->appends(request()->input())->links() }}
92
+ </div>
93
+ <!--ページネーションここまで-->
94
+ @endif
95
+ </div>
96
+ </div>
97
+ </main>
98
+ @endsection
65
99
  ```
66
100
  **サンプルデータ**
67
101
  ```php

2

web.php追加

2022/07/15 02:27

投稿

hntake
hntake

スコア9

test CHANGED
File without changes
test CHANGED
@@ -97,7 +97,12 @@
97
97
  $table->timestamps();
98
98
  });
99
99
  ```
100
-
100
+ **web.php
101
+ **
102
+ ```php
103
+ /*個別データ検索*/
104
+ Route::get('/individual/{id}',[App\Http\Controllers\TestController::class,'individual'])->name('individual');
105
+ ```
101
106
  **試したこと**
102
107
 
103
108
  コントローラー内

1

サンプルデータ追加

2022/07/15 00:50

投稿

hntake
hntake

スコア9

test CHANGED
File without changes
test CHANGED
@@ -39,7 +39,7 @@
39
39
  ]);
40
40
  }
41
41
  ```
42
- view画面
42
+ **view画面**
43
43
  ```php
44
44
  <div class="searchtable-responsive" >
45
45
  <div class="test">
@@ -63,6 +63,41 @@
63
63
  </div>
64
64
  </div>
65
65
  ```
66
+ **サンプルデータ**
67
+ ```php
68
+ $users =[
69
+ ['name' => '山田太朗',
70
+ 'user_name' => 'yamada',
71
+ 'school1' => '11',
72
+ 'school2' => '000',
73
+ 'place' => '沖縄県',
74
+ 'year' => '中2',
75
+ 'point' => '0',
76
+ 'email' => 'taro@example.com',
77
+ 'password' => 'password']
78
+ ];
79
+ ```
80
+ **create_users_table.php**
81
+ ```php
82
+ Schema::create('users', function (Blueprint $table) {
83
+ $table->id();
84
+ $table->string('name');
85
+ $table->string('user_name')->unique();
86
+ $table->string('school1')->nullable()->default('000')->index();
87
+ $table->string('school2')->nullable()->default('000')->index();
88
+ $table->string('email')->unique();
89
+ $table->timestamp('email_verified_at')->nullable();
90
+ $table->string('password');
91
+ $table->string('image')->nullable();
92
+ $table->string('place');
93
+ $table->string('year');
94
+ $table->integer('point')->default(0);
95
+ $table->integer('level')->default(0);
96
+ $table->rememberToken();
97
+ $table->timestamps();
98
+ });
99
+ ```
100
+
66
101
  **試したこと**
67
102
 
68
103
  コントローラー内