/
home
/
sjslayjy
/
public_html
/
cropnet
/
app
/
Exports
/
Upload File
HOME
<?php namespace App\Exports; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; class ExportMpp implements FromCollection,WithHeadings { /** * @return \Illuminate\Support\Collection */ public function collection() { $response= \DB::table('mpp')->where('is_active', 1)->get(); $n=0; $array=[]; foreach($response as $key=>$val){ $array[$n]['sr_no']=$key+1; $array[$n]['mpp_code']=$val->code; $array[$n]['mpp_name']=$val->name; $array[$n]['mcc_code']=$val->mcc_code; $n++; } return collect($array); } public function headings(): array { return [ 'Sr. No.', 'mpp_code', 'mpp_name', 'mcc_code' ]; } }