MyExport.php 588 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Exports;
  3. use Maatwebsite\Excel\Facades\Excel;
  4. class MyExport {
  5. public $base1_path = '/app';
  6. public $base2_path = '/excel';
  7. public function commonExport($data,$path = ''){
  8. $param = $data;
  9. $export = new CommonExport($param);
  10. $date = date('Ymd');
  11. $path = $date.'/'.$path;
  12. Excel::store($export, $path);
  13. return ['file'=>$this->base2_path.'/'.$path];
  14. }
  15. public function excelDownload($file){
  16. return response()->file(storage_path().$this->base1_path.$this->base2_path.'/'.$file);
  17. }
  18. }