Skip to content

Commit bfdf353

Browse files
Filter out project users (#437)
1 parent c1ae587 commit bfdf353

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/Web/Pages/Settings/Projects/Widgets/AddUser.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ public function form(Form $form): Form
3737
->schema([
3838
Select::make('user')
3939
->name('user')
40-
->options(fn () => User::query()->pluck('name', 'id'))
40+
->options(fn () => User::query()
41+
->whereNotExists(function ($query) {
42+
$query->select('user_id')
43+
->from('user_project')
44+
->whereColumn('users.id', 'user_project.user_id')
45+
->where('user_project.project_id', $this->project->id);
46+
})
47+
->pluck('name', 'id')
48+
)
4149
->searchable()
4250
->rules(\App\Actions\Projects\AddUser::rules($this->project)['user']),
4351
])

0 commit comments

Comments
 (0)