mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
30 lines
570 B
PHP
30 lines
570 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Libraries\ExcelUtil;
|
||
|
|
|
||
|
|
|
||
|
|
use Illuminate\Support\Collection;
|
||
|
|
use Maatwebsite\Excel\Concerns\ToCollection;
|
||
|
|
|
||
|
|
class import implements ToCollection
|
||
|
|
{
|
||
|
|
public $data;
|
||
|
|
protected $delTitle;
|
||
|
|
public function __construct($delTitle = 1)
|
||
|
|
{
|
||
|
|
$this->delTitle = $delTitle;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public function collection(Collection $rows)
|
||
|
|
{
|
||
|
|
$this->delTitle($rows);
|
||
|
|
//$rows 是数组格式
|
||
|
|
$this->data = $rows;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function delTitle (&$rows) {
|
||
|
|
$rows = $rows->slice($this->delTitle)->values();
|
||
|
|
}
|
||
|
|
}
|