Works fine in webpage but not works in api response
vadimwe opened this issue · comments
Works fine in webpage but not works in api response.
Is it possible to use it in api with api middleware?
any ideas?
No errors in logs or in runtime. Just empty object in both cases.
return response()->json([ 'status' => 1, 'geoip' => geoip()->getLocation(), '_geoip' => geoip() ]);
I`m confused. Same code works fine with blade response
@Cod3rMax big thanks for your help.
'geoip' => geoip()->getLocation()->toArray(),
works excellent.
response()->json() should convert object properties to array automatically but seems not in this case.
geoip()->getLocation()->toArray()
works perfect.
Have a great day too!