Theory
I have a fairly complete list of coordinates (latitude and longitude up to 7 decimal places), to which I want to constantly add. To stop data duplication, for each coordinate that is trying to be entered, I want to check the database to see if latitude and longitude exist on the same line.
Check if coordinates exist
$coordinate = DB::table('coordinates')
->where('lat', '=', $geocode->getLatitude())
->where('lng', '=', $geocode->getLongitude())
->count();
Migration
Schema::create('coordinates', function(Blueprint $table)
{
$table->increments('id');
$table->float('lat', 10, 7);
$table->float('lng', 10, 7);
$table->timestamps();
});
When the user address is translated, I noticed that when the dd()latitude variable, it is output as:
float(53.7960957) from code dd($geocode->getLatitude());
When I try to add it subsequently to the database by deleting dd(), the actual decimal number added to the database 53.7960968is a completely different place when we talk about coordinates!
, ?
float ? ?