diff --git a/app/Console/Commands/CheckProductBySku.php b/app/Console/Commands/CheckProductBySku.php new file mode 100644 index 00000000..7b807493 --- /dev/null +++ b/app/Console/Commands/CheckProductBySku.php @@ -0,0 +1,39 @@ +argument('sku'); + + try { + // Recupera i prodotti per lo SKU specificato + $products = Product::where('sku', $sku)->get(); + + if ($products->isNotEmpty()) { + // Mostra l'ID del primo prodotto se viene trovato + $this->info('Connection successful! Product ID: ' . $products[0]->id); + } else { + $this->error('No products found with SKU: ' . $sku); + } + } catch (\Exception $e) { + // Gestisce eventuali errori di connessione + $this->error('Error: ' . $e->getMessage()); + } + } +}