diff --git a/src/Http/Requests/StoreUserRequest.php b/src/Http/Requests/StoreUserRequest.php index 9dac08f..c65c49f 100644 --- a/src/Http/Requests/StoreUserRequest.php +++ b/src/Http/Requests/StoreUserRequest.php @@ -46,7 +46,7 @@ public function rules(): array $usersTable = config('custom-user.user.table.name'); $rules = [ - 'name' => ['string'], + 'name' => 'string|nullable', 'email' => [ 'required', 'string', 'email', Rule::unique($usersTable, 'email') @@ -60,9 +60,6 @@ public function rules(): array 'is_admin' => 'integer|nullable', ]; - (!get_attribute('name', 'optional')) - ?? array_push($rules['name'], 'required'); - (get_attribute('phone_number', 'unique')) ?? array_push($rules['phone_number'], Rule::unique($usersTable, 'phone_number')); @@ -101,7 +98,7 @@ public function toDTO(): CreateUserDTO 'phone_number' => $this ->phone_number, 'gender' => $this ->gender, 'account_type' => $this ->account_type, - 'role' => $this ->role, + 'role' => $this ->role, 'is_admin' => $this ->is_admin, ]); }