public function xlsFileYear() { $namefile = date('Yh:i:s') . "_Registration"; Excel::create($namefile, function ($excel) { // Set the title $excel->setTitle('NMK Roadshow Registration Form'); // Chain the setters $excel->setCreator('NMK Application')->setCompany('NMK'); // Call them separately $excel->setDescription('This file has roadshow registration record'); $excel->sheet('Excel sheet', function ($sheet) { $roadshow_registration = RoadshowRegistration::whereBetween('created_at', [Input::get("sd"), Input::get("ed")])->get(); $sheet->setStyle(array('font' => array('name' => 'Calibri', 'size' => 13))); $sheet->row(1, array('Name', 'Email', 'Phone', 'Position', 'Company', 'Session', 'Roadshow', 'Status')); foreach ($roadshow_registration as $key => $value) { $sheet->row(1, function ($row) { // call cell manipulation methods $row->setBackground('#888888'); $row->setFont(array('family' => 'Calibri', 'size' => '16', 'bold' => true)); }); $sheet->rows(array(array($value->name, $value->email, $value->phone, $value->position, $value->company, $value->session, $value->raodshow, $value->status))); } //$sheet->fromModel($roles); // $sheet->fromArray(array( // array('Name', 'Phone','Email','Job Title','Company','Intrested Brand','Intrested Seminiar'), // $leads // )); $sheet->setOrientation('landscape'); }); })->export('xls'); }