aa
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user