Advertisement
deCreative

Example Export Excel

Mar 14th, 2019
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. return Excel::create('Attributes_for_' . $fileName, function ($excel) use ($attributes, $fileName) {
  2. $excel->sheet($fileName, function ($sheet) use ($attributes) {
  3. $sheet->loadView('layouts.psp.category.export')->with('attributes', $attributes);
  4. });
  5. })->download('xlsx');
  6.  
  7. // Blade
  8. <table>
  9. @foreach($attributes as $code =>$arrValue)
  10. <tr>
  11. <td>{{$code}}</td>
  12. @foreach($arrValue as $index => $val)
  13. @if($code ==='option')
  14. <td>
  15. @foreach($val as $opt =>$arrOpt)
  16. {{ $arrOpt['label'].', ' }}
  17. @endforeach
  18. </td>
  19. @else
  20. <td>{{$val}}</td>
  21. @endif
  22. @endforeach
  23. </tr>
  24. @endforeach
  25. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement