No longer have to submit mandatory fields to account end point. Just submit the field you wish to update, the rest will be untouched.

This commit is contained in:
James Cole
2019-08-24 07:56:08 +02:00
parent e5e3797d9c
commit d836c8217d
6 changed files with 161 additions and 71 deletions

View File

@@ -177,6 +177,37 @@ class Request extends FormRequest
return (int)$string;
}
/**
* Return integer value, or NULL when it's not set.
*
* @param string $field
*
* @return int|null
*/
public function nullableInteger(string $field): ?int
{
$value = (string)$this->get($field);
if ('' === $value) {
return null;
}
return (int)$value;
}
/**
* Return string value, or NULL if empty.
*
* @param string $field
*
* @return string|null
*/
public function nullableString(string $field): ?string
{
$string = app('steam')->cleanString((string)($this->get($field) ?? ''));
return '' === $string ? null : $string;
}
/**
* Return string value.
*