attributes->get('api_key'); if (is_null($model->allowed_ips) || empty($model->allowed_ips)) { return $next($request); } $find = new IP($request->ip()); foreach (json_decode($model->allowed_ips) as $ip) { if (Range::parse($ip)->contains($find)) { return $next($request); } } throw new AccessDeniedHttpException('This IP address (' . $request->ip() . ') does not have permission to access the API using these credentials.'); } }