File: D:/HostingSpaces/SBogers10/beat-the-barn.komma.nl/app/Base/PriceTrait.php
<?php
namespace App\Base;
trait PriceTrait
{
public function getPrice(): string
{
// Splice on decimal divider
$explodePrice = explode('.', (string) ($this->price / 100));
// If whole number so $explodePrice[1] is not set, add the '-'
if(!isset($explodePrice[1])) $decimal = '-';
else {
if(strlen($explodePrice[1]) == 1) $decimal = $explodePrice[1] . '0';
else $decimal = $explodePrice[1];
}
return $explodePrice[0] . ',' . $decimal;
}
}