From ce8a68a72762c1087fad4cd28a42331168ba62e5 Mon Sep 17 00:00:00 2001 From: paoloar77 Date: Thu, 13 Jun 2024 08:57:58 +0200 Subject: [PATCH] aa --- app/CustomFuncPao.php | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/app/CustomFuncPao.php b/app/CustomFuncPao.php index cf445550..548260f5 100644 --- a/app/CustomFuncPao.php +++ b/app/CustomFuncPao.php @@ -223,14 +223,13 @@ function loadArticleByIdArticle($id, $checkprevendita = false) $ris = 'Articles:' . PHP_EOL; $ris .= getarraystr($articles); // Converte solo i dati specificati in JSON - - $product = Product::where('sku', $id)->first(); - - $ris .= 'Product:'. PHP_EOL; - $ris .= getarraystr($product); - - return $ris; + $product = Product::where('sku', $id)->first(); + + $ris .= 'Product:' . PHP_EOL; + $ris .= getarraystr($product); + + return $ris; } catch (\Exception $e) { return "Errore: " . $e->getMessage(); @@ -239,20 +238,27 @@ function loadArticleByIdArticle($id, $checkprevendita = false) function showOrdini() { - $orders = Order::orderBy('DataOra', 'desc')->take(20)->get(); + $str .= "Ordine: aaa"; + return $str; + + $orders = Order::orderBy('DataOra', 'desc')->take(5)->get(); $str = ""; - // Show the fields of the orders - foreach ($orders as $order) { - $str .= "Ordine: "; - $str .= getvalstr("Id", $order->id); - $str .= getvalstr("DataOra", $order->DataOra); - $str .= getvalstr("Totale", $order->Totale); + try { + + // Show the fields of the orders + foreach ($orders as $order) { + $str .= "Ordine: "; + $str .= getvalstr("Id", $order->id); + $str .= getvalstr("DataOra", $order->DataOra); + $str .= getvalstr("Totale", $order->Totale); + } + } catch (\Exception $e) { + return "Errore: " . $e->getMessage(); } return $str; - } function libriInPrevendita()