Reputation:
I use this repository.
But, I don't know how to check if that data exists.
Help me.
All codes error.
Reader::connect()->city($_SERVER["REMOTE_ADDR"]);
Reader::connect()->city($_SERVER["REMOTE_ADDR"])->mostSpecificSubdivision->name;
Reader::connect()->city($request->ip());
Reader::connect()->city($request->ip())->mostSpecificSubdivision->name;
In the first place, an error has occurred at the time of the city function.
Upvotes: 0
Views: 76
Reputation: 5270
check your ip exist use isset
like below
if(isset($request->ip())){
//Your code here
}
Upvotes: 0