I'm trying to use Laravel excel https://github.com/Maatwebsite/Laravel-Excel
I have a simple question, how do I put the rows loaded in, into my database, and also how do I display them in a table in my view. The CSV file i'm loading only has one column, with the heading "Email".
Below is my simple code
Controller:
public
function importCSV() {
$excel = \App::make('excel');
$excel - > load('kad.csv', function($reader) {
$reader - > takeColumns(1);
}) - > get();
return view('index', compact('excel'));
}
View:
@extends('layouts.master') @section('content')
<table class="table table-striped">
@foreach($excel as $ex)
<tr>
<td>
{{$ex->Email}}
</td>
</tr>
@endforeach
</table>
@endsection
My view simply displays blank. What is the right way to go about this? Kind regards