mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 18:31:36 +00:00
29 lines
607 B
PHP
Executable File
29 lines
607 B
PHP
Executable File
<?php
|
|
|
|
namespace App\ValidationRules;
|
|
|
|
use Illuminate\Contracts\Validation\Rule;
|
|
|
|
class RestrictedIPAddressesRule implements Rule
|
|
{
|
|
/**
|
|
* Determine if the validation rule passes.
|
|
*
|
|
* @param string $attribute
|
|
* @param mixed $value
|
|
* @return bool
|
|
*/
|
|
public function passes($attribute, $value)
|
|
{
|
|
return ! in_array($value, config('core.restricted_ip_addresses'));
|
|
}
|
|
|
|
/**
|
|
* @return array|\Illuminate\Contracts\Translation\Translator|string|null
|
|
*/
|
|
public function message()
|
|
{
|
|
return __('IP address is restricted.');
|
|
}
|
|
}
|