Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 3afa96c

Browse files
committed
feat(admin): Add "last login at" field
1 parent 049e2be commit 3afa96c

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/Controller/Admin/UserCrudController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function configureFields(string $pageName): iterable
5555
AssociationField::new('group', 'Group'),
5656
DateTimeField::new('created_at', 'Created at')->hideOnForm(),
5757
DateTimeField::new('updated_at', 'Updated at')->hideOnForm(),
58+
DateTimeField::new('last_login_at', 'Last login at'),
5859
];
5960
}
6061

src/Entity/User.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,16 @@ public function setName(string $name): static
217217
return $this;
218218
}
219219

220+
public function getLastLoginAt(): ?\DateTimeInterface
221+
{
222+
$lastLoginEvent = $this->loginEvents->last();
223+
if (false === $lastLoginEvent) {
224+
return null;
225+
}
226+
227+
return $lastLoginEvent->getCreatedAt();
228+
}
229+
220230
/**
221231
* @return Collection<int, SolutionEvent>
222232
*/

translations/messages.zh_TW.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Kind: 種類
6969
Text Content: 文字內容
7070
HTML Content: HTML 內容
7171
EmailTemplates: 郵件範本
72+
Last login at: 最後登入時間
7273

7374
result_presenter.tabs.result: 執行結果
7475
result_presenter.tabs.answer: 正確答案

0 commit comments

Comments
 (0)