Level 12
@badrus_junior You have to reference your $data when you're using it with the callback functions.
Like in the below example.
$data = [];
Voucher::with(['merchant:id,nama','offer:id,nama','payment:id,nama'])
->select('voucher.*')
->chunk(1000, function($vouchers) use(&$data){
foreach ($vouchers as $v){
$data[] = array( 'ID' => $v->id, 'Date' => date('d/m/Y',strtotime($v->qty)), );
}
});