Code and routes for rules.

This commit is contained in:
James Cole
2018-12-07 16:03:05 +01:00
parent 9a2e5c36a1
commit 8e4092e7d7
7 changed files with 206 additions and 41 deletions

View File

@@ -27,6 +27,7 @@ use Illuminate\Foundation\Http\FormRequest;
/**
* Class Request.
*
* @codeCoverageIgnore
*
* @SuppressWarnings(PHPMD.NumberOfChildren)
@@ -52,6 +53,29 @@ class Request extends FormRequest
return 1 === (int)$this->input($field);
}
/**
* @param string $value
*
* @return bool
*/
public function convertBoolean(string $value): bool
{
if ('true' === $value) {
return true;
}
if (1 === $value) {
return true;
}
if ('1' === $value) {
return true;
}
if (true === $value) {
return true;
}
return false;
}
/**
* Return floating value.
*