код ниже, также убедитесь, что first ip
<<code>second ip
public function store(Request $request)
{
$this->validate($request, [
'pool_name' => 'required|unique:pools|max:10',
'server_id' => 'required',
'range_ip' => [
'required',
function($attribute, $value, $fail) {
$validIp = array_filter(explode('-', $value), function($ip) {
return filter_var($ip, FILTER_VALIDATE_IP);
});
if ( (count($validIp) !== 2) || (ip2long($validIp[0]) >= ip2long($validIp[1])) )
{
return $fail($attribute.' is invalid.');
}
},
],
]);
}