Siopas Inventory PETI for ISTW Website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
1021 B

<?php
namespace App\Exports;
use App\Models\Kondisi_Peti;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;
class KondisiPetiExport implements FromCollection, WithHeadings
{
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
// Ambil data dari model Peti
$kondisipetis = Kondisi_Peti::select(
'id',
'nama_kondisi',
'deskripsi_kondisi',
)->get();
// Modifikasi data dan tambahkan nomor
$data = $kondisipetis->map(function ($kondisipeti) use (&$nomor) {
return [
'No' => $kondisipeti->id,
'Kondisi Peti' => $kondisipeti->nama_kondisi,
'Deskripsi' => $kondisipeti->deskripsi_kondisi,
];
});
return $data;
}
public function headings(): array
{
return [
'No',
'KONDISI PETI',
'DESKRIPSI',
];
}
}