Anons79 Mini Shell

Directory : /home/aplikasiposinfo/public_html/paraduta.fixmate.id/app/Exports/
Upload File :
Current File : /home/aplikasiposinfo/public_html/paraduta.fixmate.id/app/Exports/KirimSuppliersExport.php

<?php

namespace App\Exports;

use App\Models\KirimSupplier;
use Maatwebsite\Excel\Concerns\FromArray;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithStyles;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

class KirimSuppliersExport implements FromArray, WithHeadings, ShouldAutoSize, WithEvents
{   

    /**
     * @return \Illuminate\Support\Collection
     */
    /**
     * @var array
     */
    protected $export;

    /**
     * ExampleExport constructor.
     *
     * @param array $export
     */
    public function __construct(array $export)
    {
        $this->export = $export;
    }


    /**
     * @return array
     */
    public function array(): array
    {
        return $this->export;
    }

    /**
     * @return array
     */
    public function headings(): array
    {
        // Mengembalikan baris judul (header)
        return [
            'Tanggal',
            'No Kirim',
            'Item',
            'Jumlah',
            'Harga Awal',
            'Harga Supplier'
        ];
    }

    /**
     * @return array
     */
    public function registerEvents(): array
    {
        return [
            AfterSheet::class => function (AfterSheet $event) {
                // Menetapkan style pada baris header
                $event->sheet->getStyle('1')->applyFromArray([
                    'font' => [
                        'bold' => true,
                        'size' => 12,

                    ]
                ]);
            },
        ];
    }
}

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]