PK

ADDRLIN : /home/questend/public_html/subdomain/payroll.questend.com/app/Exports/
FLL :
Current File : /home/questend/public_html/subdomain/payroll.questend.com/app/Exports/EsiExport.php

<?php

namespace App\Exports;

use App\Models\Payroll;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;

class EsiExport implements FromCollection, WithHeadings
{
    protected int $month;
    protected int $year;

    public function __construct(int $month, int $year)
    {
        $this->month = $month;
        $this->year  = $year;
    }

    public function collection()
    {
        return Payroll::with('employee')
            ->where('month', $this->month)
            ->where('year', $this->year)
            ->where('gross', '<=', 21000)
            ->get()
            ->map(fn($p) => [
                $p->employee->esi_no,
                $p->employee->name,
                $p->gross,
                $p->esi_employee,
                $p->esi_employer
            ]);
    }

    public function headings(): array
    {
        return [
            'IP Number',
            'Employee Name',
            'Gross Wages',
            'Employee Contribution',
            'Employer Contribution'
        ];
    }
}


PK 99
E-SHOP || DASHBOARD
404

Page Not Found

It looks like you found a glitch in the matrix...

← Back to Home