Added read invoice import class
This commit is contained in:
26
app/Imports/ExcelImport.php
Normal file
26
app/Imports/ExcelImport.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Imports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\ToCollection;
|
||||
|
||||
class ExcelImport implements ToCollection
|
||||
{
|
||||
public $rows = [];
|
||||
|
||||
/**
|
||||
* @param Collection $collection
|
||||
*/
|
||||
public function collection(Collection $collection)
|
||||
{
|
||||
foreach($collection as $item) {
|
||||
self::$rows[] = $item->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
public function getRows()
|
||||
{
|
||||
return self::$rows;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user