Ids.php
606 字节
<?php
namespace App\Rules;
use App\Helper\Arrays;
use Illuminate\Contracts\Validation\Rule;
class Ids implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
$ids = array_filter(Arrays::splitFilterToArray($value), 'intval');
return boolval($ids);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'ID不能为空';
}
}