Skip to content

Commit

Permalink
Fix user issue introduced in composer update
Browse files Browse the repository at this point in the history
In v8.32.0, laravel/framework#36504 was merged which fixes null being
treated as true by the validator, but also enforces strict checking for
boolean values given to the required_unless rule. That's not necessarily
a bad thing, it just means we can't be passing `1` when we want `true`.

When we use `1`, user tests fail because while we pass `'user_group' =>
true` in the request data, the validator checks explicitly for `1` which
it doesn't see, so it says "gid is required unless user group is in 1".
We don't want that.
  • Loading branch information
dshoreman committed Apr 20, 2021
1 parent 9a7a208 commit ee43d0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Requests/System/CreateUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CreateUser extends SaveUser
public function rules(): array
{
return array_merge(parent::rules(), [
'gid' => 'integer|required_unless:user_group,1',
'gid' => 'integer|required_unless:user_group,true',
'system' => 'boolean|nullable',
'create_home' => 'boolean',
'user_group' => 'boolean',
Expand Down

0 comments on commit ee43d0b

Please sign in to comment.