diff --git a/app/Exports/ProductsExport.php b/app/Exports/ProductsExport.php new file mode 100644 index 0000000..607685a --- /dev/null +++ b/app/Exports/ProductsExport.php @@ -0,0 +1,35 @@ +select('id', 'name', 'sku', 'quantity', 'price'); + if (request()->filled('search')) { + $search = request('search'); + $q->where('name', 'like', "%{$search}%"); + if (request()->filled('sort') && request()->filled('order')) { + $sort = request('sort'); + $order = request('order'); + $q->orderBy($sort, $order); + } + } + return $q; + } + + public function headings(): array + { + return ['ID', '상품명', 'SKU', '수량', '가격']; + } +} diff --git a/app/Http/Controllers/ProductExportController.php b/app/Http/Controllers/ProductExportController.php new file mode 100644 index 0000000..1618fff --- /dev/null +++ b/app/Http/Controllers/ProductExportController.php @@ -0,0 +1,16 @@ +=7.4.0 <8.5.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-main", + "dompdf/dompdf": "^1.0 || ^2.0 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.2", + "mitoteam/jpgraph": "^10.3", + "mpdf/mpdf": "^8.1.1", + "phpcompatibility/php-compatibility": "^9.3", + "phpstan/phpstan": "^1.1", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^8.5 || ^9.0", + "squizlabs/php_codesniffer": "^3.7", + "tecnickcom/tcpdf": "^6.5" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "ext-intl": "PHP Internationalization Functions", + "mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "support": { + "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.30.1" + }, + "time": "2025-10-26T16:01:04+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.4", diff --git a/resources/views/product/list.blade.php b/resources/views/product/list.blade.php index 1a133aa..dcff13e 100644 --- a/resources/views/product/list.blade.php +++ b/resources/views/product/list.blade.php @@ -4,7 +4,7 @@

📋 상품 목록

- + 상품 추가 + + 상품 추가
@if(session('success')) @@ -21,15 +21,18 @@
-
+
-
+
+ diff --git a/routes/web.php b/routes/web.php index 63b6a75..e090201 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,6 +2,7 @@ use App\Http\Controllers\LoginController; use App\Http\Controllers\ProductController; +use App\Http\Controllers\ProductExportController; use App\Http\Controllers\statsController; use App\Http\Controllers\StockLogController; use App\Http\Middleware\Authenticate; @@ -53,9 +54,13 @@ Route::post('/stock/input/{id}', [StockLogController::class, 'store']) ->name('stock.store'); // 입출고 이력 -Route::get('/stock}', [StockLogController::class, 'index']) +Route::get('/stock', [StockLogController::class, 'index']) ->name('stock.list'); // 통계 -Route::get('/stats}', [statsController::class, 'index']) +Route::get('/stats', [statsController::class, 'index']) ->name('stats'); + +// 다운로드 +Route::get('/product/export', ProductExportController::class) + ->name('products.export');