Anons79 Mini Shell

Directory : /home/aplikasiposinfo/www/keuangan-organisasi.aplikasipos.info/app/Exports/
Upload File :
Current File : /home/aplikasiposinfo/www/keuangan-organisasi.aplikasipos.info/app/Exports/DuesDataExport.php

<?php

namespace App\Exports;

use App\Models\Transaction;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;

class DuesDataExport implements FromView
{

    private $year;

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

    public function view(): View
    {
        $year = $this->year;
        $sumAmount = Transaction::where('type', 'Dues')->sum("amount");
        return view('dues/table', [
            'report' => Transaction::all(),
            'year' => $year,
            'sumAmount' => $sumAmount,
        ]);
    }

    // public function collection()
    // {
    //     // Query data yang ingin diekspor, sesuai dengan logic yang Anda butuhkan
    //     $transactions = Transaction::selectRaw('member_id')
    //         ->where('type', 'Dues')
    //         ->whereIn('member_id', auth()->user()->member->pluck('id'))
    //         ->whereYear('date', $this->year)
    //         ->groupBy('member_id')
    //         ->orderBy('date', 'asc')
    //         ->get();

    //     // Anda perlu memformat data sesuai dengan kebutuhan Anda
    //     // Di sini, saya hanya mengembalikan data dalam bentuk collection
    //     return $transactions;
    // }

    // public function headings(): array
    // {
    //     // Sesuaikan dengan heading yang Anda inginkan di file Excel
    //     return [
    //         // Tambahkan kolom-kolom lainnya di sini
    //     ];
    // }
}

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