Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8
Filters a variable with a specified filter
<?php filter_var(mixed $value, int $filter = FILTER_DEFAULT, array|int $options = 0): mixed
<?php     public function ensureLocalRequest()

    {

        $ipIsPublic = filter_var(

            request()->ip(),

            FILTER_VALIDATE_IP,

            FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE

        );



        if ($ipIsPublic) {

            abort(403, "Solutions can only be executed by requests from a local IP address. Please also make sure `APP_DEBUG` is set to false on ANY production environment.");