Open dijkr opened 1 year ago
One solution to process it in the view: {{ '€' . ' ' . number_format($product->Price, 2) }} This works, and it also makes sure that any mistake in the retrieval from prices would be corrected.
Still need a solution to automatically process the price at retrieval. Should it be done at the model or the controller. This should work:
public function formattedPrice() { return number_format($this->price, 2); }
Prices are stored with datatype float. They however show every digit after the main numbers. And it won't show any zero's if the numbers after the main number end with a zero. It need to have two digits after the main number. 1,00 and 2,95.