If you’ve ever written a Laravel migration, you’ve likely been confused and stuck on picking the right column type for your numeric data when you pick Laravel for your Ecommerce or Invoicing application. Should you use a float for that price? Maybe a decimal for currency? Or does double sound fancy enough for VAT value?
Laravel’s migration system uses its handy schema builder to define database tables. But choosing the wrong numeric type can lead to rounding errors and performance problems.
In this article you’ll get an idea about the differences between integer, float, decimal, double, and other numeric types in Laravel’s schema builder and also when to use each one.