From 4688100ca0fcc707c2e37f7a326391fa557b4a33 Mon Sep 17 00:00:00 2001 From: Joshua Blum Date: Mon, 25 May 2026 14:46:29 +0200 Subject: [PATCH 1/2] Correctly resolve `default: current` --- src/Fieldtypes/Users.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Fieldtypes/Users.php b/src/Fieldtypes/Users.php index 09157cad83..298771dc76 100644 --- a/src/Fieldtypes/Users.php +++ b/src/Fieldtypes/Users.php @@ -254,7 +254,11 @@ public function augment($values) { $single = $this->config('max_items') === 1; - $ids = Arr::wrap($values); + $ids = collect(Arr::wrap($values)) + ->map(fn ($id) => $id === 'current' ? User::current()?->id() : $id) + ->filter() + ->values() + ->all(); $query = (new OrderedQueryBuilder(User::query(), $ids))->whereIn('id', $ids); From d0d3d378b8075ac1f3c7531092576736a249d773 Mon Sep 17 00:00:00 2001 From: Joshua Blum Date: Mon, 25 May 2026 14:50:26 +0200 Subject: [PATCH 2/2] Add test --- tests/Fieldtypes/UsersTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Fieldtypes/UsersTest.php b/tests/Fieldtypes/UsersTest.php index 6539c4b6e2..73cbf6ce80 100644 --- a/tests/Fieldtypes/UsersTest.php +++ b/tests/Fieldtypes/UsersTest.php @@ -60,6 +60,17 @@ public function it_augments_to_a_single_user_when_max_items_is_one() $this->assertEquals('one@domain.com', $augmented->email()); } + #[Test] + public function it_augments_the_current_user_when_value_is_the_current_string() + { + $this->actingAs(Facades\User::find('123')); + + $augmented = $this->fieldtype(['max_items' => 1])->augment('current'); + + $this->assertInstanceOf(User::class, $augmented); + $this->assertEquals('123', $augmented->id()); + } + #[Test] public function it_shallow_augments_to_a_collection_of_users() {