You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spp-paud/app/Exports/TabunganSiswaExport.php

30 lines
615 B
PHP

<?php
namespace App\Exports;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use App\Models\Tabungan;
use App\Models\Siswa;
class TabunganSiswaExport implements FromView
{
public function __construct($siswa)
{
$this->id = $siswa->id;
$this->siswa = $siswa;
}
public function collection()
{
return Tabungan::where('siswa_id', $this->id)->get();
}
public function view(): View
{
return view('siswa.tabunganexport', [
'tabungan' => $this->collection(),
'siswa' => $this->siswa
]);
}
}