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) { $vat = 0; //if (env('VAT_MANAGE', 0) == 1) //{ $vats = \App\Models\Vat::select('id', 'name', 'value')->orderBy('value')->get(); 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; } function currencyToDouble($val) { $x = str_replace("€", "", $val); $x = str_replace(".", "", $x); $x = str_replace(",", ".", $x); return floatval(trim($x)); } function getConfiguration($field) { $ret = ""; $conf = \App\Models\Configurration::first(); if ($conf) { $ret = $conf[$field]; } return $ret; }