Fix Geoip controller
This commit is contained in:
@@ -9,6 +9,6 @@ class GeoIPController extends Controller
|
||||
{
|
||||
public function index(Request $request, $ip = null)
|
||||
{
|
||||
return (array)geoip($ip = null)->getLocation();
|
||||
return geoip($ip)->getLocation()->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,12 +245,14 @@ const fetch_rates = async () => {
|
||||
|
||||
const fetch_ccodes = async () => {
|
||||
try {
|
||||
const response2 = await axios.get(route('geo.ip.get'));
|
||||
geoip.value = response2.data;
|
||||
|
||||
const response = await axios.get(route('ccountry.codes'))
|
||||
ccodes.value = response.data;
|
||||
ccodes.value = Object.entries(ccodes.value).map(([k, v]) => { if (v !== null) return { "country": k, "code": v } }).filter(n => n);
|
||||
console.log("ccodes=", ccodes.value);
|
||||
const response2 = await axios.get(route('geo.ip.get'));
|
||||
geoip.value = response2.data;
|
||||
|
||||
} catch (e) {
|
||||
const response = await Swal.fire({
|
||||
title: __('are you want to try again') + '?',
|
||||
@@ -354,6 +356,7 @@ const submit = () => {
|
||||
|
||||
watch(ccodes, (codes) => {
|
||||
console.log('NNN=',codes);
|
||||
console.log('IP=',geoip.value);
|
||||
codes.forEach((c) => { if (c.code == geoip.value.iso_code) form.country = c; });
|
||||
console.log(form.country);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user