forked from are0h/TheBadSpace
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
955 B
PHTML
36 lines
955 B
PHTML
1 year ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers;
|
||
|
|
||
|
class ExportController extends Controller
|
||
|
{
|
||
|
//
|
||
|
public function exportCSV()
|
||
|
{
|
||
|
/*
|
||
|
$columns = [
|
||
|
'id',
|
||
|
'product_name',
|
||
|
'product_url',
|
||
|
'price',
|
||
|
'category'
|
||
|
];
|
||
|
|
||
|
$products = [
|
||
|
[1, 'product 1', 'https://example.com/product-1', '9.99', 'category 1'],
|
||
|
[2, 'product 2', 'https://example.com/product-2', '19.99', 'category 2'],
|
||
|
[3, 'product 3', 'https://example.com/product-3', '29.99', 'category 3'],
|
||
|
[4, 'product 4', 'https://example.com/product-4', '39.99', 'category 4'],
|
||
|
];
|
||
|
|
||
|
header('Content-Type: text/csv');
|
||
|
header('Content-Disposition: attachment; filename="products.csv"');
|
||
|
|
||
|
echo implode(',', $columns) . PHP_EOL;
|
||
|
foreach ($products as $product) {
|
||
|
echo implode(',', $product) . PHP_EOL;
|
||
|
}
|
||
|
*/
|
||
|
}
|
||
|
}
|