diff --git a/app/Http/Controllers/ArticleController.php b/app/Http/Controllers/ArticleController.php index b949e8cc..0a376971 100755 --- a/app/Http/Controllers/ArticleController.php +++ b/app/Http/Controllers/ArticleController.php @@ -137,4 +137,37 @@ class ArticleController extends Controller return new Response('Error exporting articles: ' . $e->getMessage(), 500); } } + + public function test(Request $request) + { + try { + + $articoli = $this->queryTest(); + + dd($articoli); + + } catch (\Exception $e) { + // Potresti considerare di registrare l'errore per debugging + return new Response('Erroe test: ' . $e->getMessage(), 500); + + } + } + public function queryTest() + { + try { + $duplicati = DB::table('T_WEB_Articoli') + ->select('idArticolo', 'Titolo', 'DataPubblicazione', 'Ean13', DB::raw('count(*) as total')) + ->groupBy('idArticolo', 'Titolo', 'DataPubblicazione', 'Ean13') + ->having('total', '>', 0) // Filtra duplicati + ->get(); + + + return $duplicati; + + } catch (\Exception $e) { + return new Response('Errore: ' . $e->getMessage(), 500); + } + + } +} } \ No newline at end of file