xxxxxxxxxx
Its required maatwebsite/excel package
Deatils tutorial in our bolg:
xxxxxxxxxx
use Illuminate\Support\Facades\Response;
use App\Product;
public function export()
{
$products = Product::all();
$csvFileName = 'products.csv';
$headers = [
'Content-Type' => 'text/csv',
'Content-Disposition' => 'attachment; filename="' . $csvFileName . '"',
];
$handle = fopen('php://output', 'w');
fputcsv($handle, ['Name', 'Price']); // Add more headers as needed
foreach ($products as $product) {
fputcsv($handle, [$product->name, $product->price]); // Add more fields as needed
}
fclose($handle);
return Response::make('', 200, $headers);
}
xxxxxxxxxx
use Illuminate\Support\Facades\Response;
use App\Product;
public function export()
{
$products = Product::all();
$csvFileName = 'products.csv';
$headers = [
'Content-Type' => 'text/csv',
'Content-Disposition' => 'attachment; filename="' . $csvFileName . '"',
];
$handle = fopen('php://output', 'w');
fputcsv($handle, ['Name', 'Price']); // Add more headers as needed
foreach ($products as $product) {
fputcsv($handle, [$product->name, $product->price]); // Add more fields as needed
}
fclose($handle);
return Response::make('', 200, $headers);
}
xxxxxxxxxx
Its required maatwebsite/excel package
Deatils tutorial in our bolg:
xxxxxxxxxx
Its required maatwebsite/excel package
Deatils tutorial in our bolg:
xxxxxxxxxx
Its required maatwebsite/excel package
Deatils tutorial in our bolg:
xxxxxxxxxx
Its required maatwebsite/excel package
Deatils tutorial in our bolg:
xxxxxxxxxx
Its required maatwebsite/excel package
Deatils tutorial in our bolg:
xxxxxxxxxx
Its required maatwebsite/excel package
Deatils tutorial in our bolg:
xxxxxxxxxx
Its required maatwebsite/excel package
Deatils tutorial in our bolg: