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();
}
}