orderBy('name')->get(); } function getCategories() { return \App\Models\Category::where('enabled', true)->where('parent_id', null)->orderBy('name')->get(); } function formatPrice($price) { return "€ " . number_format($price, 2, ",", "."); } function getVatValue($v, $i) { $vats = \App\Models\Vat::select('id', 'name', 'value')->orderBy('value')->get(); $vat = 0; if ($i > 0) { $iv = 0; foreach($vats as $vv) { if ($vv->id == $i) { $iv = $vv->value; break; } } if ($iv > 0) $vat = $v / 100 * $iv; } return $vat; } function mysqlToDate($dt) { list($date, $hour) = explode(" ", $dt); list($year, $month, $day) = explode("-", $date); return $day . "/" . $month . "/" . $year; }