ExcelModel.php 577 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Excel;
  5. class ExcelModel extends Model
  6. {
  7. //导出数据
  8. protected function downloadExcel($cellData,$title)
  9. {
  10. array_unshift($cellData,$title);
  11. Excel::create('金币场充值数据',function($excel) use ($cellData){
  12. $excel->sheet('score', function($sheet) use ($cellData){
  13. $sheet->rows($cellData);
  14. $sheet->setWidth(array('A'=>15,'B'=>15,'C'=>15,'D'=>15,'E'=>15,'F'=>15,'G'=>15,'H'=>15));
  15. });
  16. })->export('xls');
  17. }
  18. }