24 lines
571 B
PHP
24 lines
571 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Product;
|
|
use Illuminate\Http\Request;
|
|
|
|
class statsController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$title = '통계';
|
|
// 총 상품 수량
|
|
$totalQuantity = Product::sum('quantity');
|
|
// 총 상품 종류
|
|
$productCount = Product::count();
|
|
// 수량이 10 미만인 상품 목록
|
|
$products = Product::where('quantity', '<', 10)->get();
|
|
|
|
|
|
return view ('stats.index', compact('title', 'totalQuantity', 'productCount', 'products'));
|
|
}
|
|
}
|