aa
This commit is contained in:
@@ -93,9 +93,13 @@ class ArticleController extends Controller
|
||||
$articoli = Article::where('IdArticolo', $idArticolo)
|
||||
->get(); // Usa
|
||||
|
||||
if ($articoli->isEmpty()) {
|
||||
return ['error' => 'Nessun articolo'];
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Registrazione dell'errore
|
||||
return response()->json(['error' => 'Si è verificato un errore durante il recupero dei dati: ' . $e->getMessage()], 500);
|
||||
return ['error' => 'Si è verificato un errore durante il recupero dei dati: ' . $e->getMessage()];
|
||||
}
|
||||
|
||||
return $articoli;
|
||||
@@ -242,6 +246,10 @@ class ArticleController extends Controller
|
||||
|
||||
$articoli = $this->queryshowInfoArticolo($idArticolo);
|
||||
|
||||
if ($articoli && isset($articoli['error'])) {
|
||||
return view('error', ['message' => $articoli['error']]);
|
||||
}
|
||||
|
||||
return view('info-articolo', ['articoli' => $articoli]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user