Add stricter validation around ACARS/PIREP API updates #149

This commit is contained in:
Nabeel Shahzad
2018-01-23 11:46:26 -06:00
parent ea4f4d25f5
commit edb72e462f
4 changed files with 130 additions and 48 deletions

25
app/Rules/Minutes.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
/**
* Class Minutes
* @package App\Rules
*
* Make sure that a given value is an integer, but the custom
* validation message is what really matters here
*/
class Minutes implements Rule
{
public function passes($attribute, $value): bool
{
return \is_int(filter_var($value, FILTER_VALIDATE_INT));
}
public function message(): string
{
return ':attribute must be an integer, in minutes';
}
}