WHEN to Use Cents vs. Floats for Money in Laravel DB? (Practical Example)

Laravel Daily Laravel Daily

5,175
1 tháng trước
There's a common advice to NEVER store money in decimal or float. But does it make the actual difference in typical Laravel projects? Let me show you a few examples.

Related tutorial: Dealing With Money in Laravel/PHP: Best Practices https://laraveldaily.com/post/money-laravel-php-best-practices?mtm_campaign=youtube-251013-money-float-int

Support the channel by checking out my products:
- My Laravel courses: https://laraveldaily.com/courses
- Filament examples: https://filamentexamples.com
- Livewire Kit Components: https://livewirekit.com

Other places to follow:
- My weekly Laravel newsletter: https://us11.campaign-archive.com/home/?u=a459401212599a54203d036ee&id=91c1337873
- My personal Twitter: https://twitter.com/povilaskorop