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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -