Nana-Odai
1 year ago
153
2
Laravel

Values with 00 as decimals not showing after querying from database

Posted 1 year ago by Nana-Odai

I am querying values from database with datatype double. The values with example like 10.00 as aren't showing the 00 but shows 10. Also values like 10.25, 10.01 are showing the decimals, what do i need to do to get 10.00?

I used the below code in my model but the 00 decimals aren't showing and shows 10 instead of 10.00,

protected $casts = [
        'childNonInsuredTarrif' => 'double',
        'childInsuredTarrif' => 'double',
    ];

Please sign in or create an account to participate in this conversation.