teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

追記

2020/09/20 05:30

投稿

phper.k
phper.k

スコア3923

answer CHANGED
@@ -317,8 +317,8 @@
317
317
  <th>ユーザーID</th>
318
318
  <th>ユーザー名</th>
319
319
  <th>メールアドレス</th>
320
- <th>最近借りた本</th>
320
+ <th>本日貸出した本</th>
321
- <th>貸日時</th>
321
+ <th>貸出日時</th>
322
322
  </tr>
323
323
  </thead>
324
324
  <tbody>

1

修正

2020/09/20 05:30

投稿

phper.k
phper.k

スコア3923

answer CHANGED
@@ -287,7 +287,7 @@
287
287
  public function index(): View
288
288
  {
289
289
  $users = User::with(['books' => function ($query) {
290
- $query->orderByDesc('pivot_created_at');
290
+ $query->whereDate('pivot_created_at', now());
291
291
  }])->get();
292
292
  return view('users.index', compact('users'));
293
293
  }