From 135ef9b94fbd90b679580a1bcebf51f459879374 Mon Sep 17 00:00:00 2001 From: Tofandel Date: Mon, 18 Mar 2024 16:19:49 +0100 Subject: [PATCH] Fix user creation is missing a role input --- .../Controllers/Admin/ModuleController.php | 4 ++-- views/users/create.blade.php | 20 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/Http/Controllers/Admin/ModuleController.php b/src/Http/Controllers/Admin/ModuleController.php index 08d06c728..87172bd83 100644 --- a/src/Http/Controllers/Admin/ModuleController.php +++ b/src/Http/Controllers/Admin/ModuleController.php @@ -1778,7 +1778,7 @@ protected function getIndexData(array $prependScope = []): array // @todo: use $this->filters instead of indexData. $indexDataWithoutFilters = $this->indexData($this->request); foreach ($indexDataWithoutFilters as $key => $value) { - if (Str::endsWith($key, 'List')) { + if ($key !== 'roleList' && Str::endsWith($key, 'List')) { unset($indexDataWithoutFilters[$key]); } } @@ -1922,7 +1922,7 @@ public function filters(): TableFilters $tableFilters = TableFilters::make(); foreach ($this->indexData($this->request) as $key => $value) { - if (Str::endsWith($key, 'List')) { + if ($key !== 'roleList' && Str::endsWith($key, 'List')) { $queryString = Str::beforeLast($key, 'List'); if ($filterKey = ($this->filters[$queryString] ?? false)) { diff --git a/views/users/create.blade.php b/views/users/create.blade.php index 9fe16907f..63943c512 100644 --- a/views/users/create.blade.php +++ b/views/users/create.blade.php @@ -11,16 +11,14 @@ type="email" /> - @can('edit-user-roles') - @php $userModel = twillModel('user') @endphp + @php $userModel = twillModel('user') @endphp - - @endcan + @endunless