aa
This commit is contained in:
@@ -46,6 +46,10 @@ class ArticleController extends Controller
|
||||
// ->take(50)
|
||||
->get();
|
||||
|
||||
if ($articoliVenduti->isEmpty()) {
|
||||
return response()->json(['message' => 'Nessun articolo trovato.'], 404);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Registrazione dell'errore
|
||||
return response()->json(['error' => 'Si è verificato un errore durante il recupero dei dati: ' . $e->getMessage()], 500);
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Articoli Venduti</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container mt-4">
|
||||
<h1 class="mb-4">Articoli Venduti</h1>
|
||||
@@ -28,12 +30,15 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<pre>{{ print_r($articoliVenduti, true) }}</pre>
|
||||
|
||||
@if ($articoliVenduti->isEmpty())
|
||||
<tr>
|
||||
<td colspan="6" class="text-center">Nessun articolo trovato.</td>
|
||||
</tr>
|
||||
@else
|
||||
@foreach ($articoliVenduti as $articolo)
|
||||
@if (isset($articolo->idArticolo))
|
||||
<tr>
|
||||
<td>{{ $articolo->idArticolo }}</td>
|
||||
<td>{{ $articolo->Titolo }}</td>
|
||||
@@ -48,10 +53,12 @@
|
||||
<td>{{ $articolo->totaleVendutoUltimoAnno }}</td>
|
||||
<td>{{ $articolo->totaleVendutoUltimi2Anni }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user