laravel - How to get the data read from excel file and display in my view? -
in controller, load excel file when click on button.
excel::load(input::file('import_file')->getrealpath(), function ($reader) use($arr){ // how can $reader data , pass view? }); return redirect()->back()->with('reader',...);
in view, display data excel file
@if(!empty(session::get('reader'))) $(function() { @foreach(session()->get('reader') $key=>$row) alert('{{$row['id']}}'); @endforeach }); @endif
can guide me how can make pass data view?
you directly store result array. code should like
$reader= \excel::load(input::file('import_file'))->toarray(); return redirect()->back()->with('reader', $reader);
Comments
Post a Comment