This commit is contained in:
James Cole
2019-09-20 06:14:08 +02:00
parent 845e67e9be
commit c14d3f40a9
9 changed files with 120 additions and 8 deletions

View File

@@ -224,6 +224,19 @@ class Request extends FormRequest
return app('steam')->cleanString((string)($this->get($field) ?? ''));
}
/**
* Return string value, but keep newlines.
*
* @param string $field
*
* @return string
*/
public function nlString(string $field): string
{
return app('steam')->nlCleanString((string)($this->get($field) ?? ''));
}
/**
* Parse and clean a string.
*
@@ -242,6 +255,24 @@ class Request extends FormRequest
}
/**
* Parse and clean a string, but keep the newlines.
*
* @param string|null $string
*
* @return string|null
*/
public function nlStringFromValue(?string $string): ?string
{
if (null === $string) {
return null;
}
$result = app('steam')->nlCleanString($string);
return '' === $result ? null : $result;
}
/**
* Return date or NULL.
*