29 lines
658 B
PHP
29 lines
658 B
PHP
|
|
<?php
|
||
|
|
namespace App\Exports;
|
||
|
|
|
||
|
|
use App\Exports\Sheets\LoveActiveUser;
|
||
|
|
use App\Exports\Sheets\SaasActiveUser;
|
||
|
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||
|
|
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||
|
|
|
||
|
|
class ProvinceUserExport implements WithMultipleSheets
|
||
|
|
{
|
||
|
|
protected $users;
|
||
|
|
public function __construct($users)
|
||
|
|
{
|
||
|
|
$this->users = $users;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function sheets(): array
|
||
|
|
{
|
||
|
|
$users = $this->users;
|
||
|
|
$sheets = [];
|
||
|
|
$chunks = $users->chunk(1000);
|
||
|
|
for ($i=0; $i < count($chunks); $i++) {
|
||
|
|
$sheets[] = new CityUsersExport($chunks[$i], $i);
|
||
|
|
}
|
||
|
|
|
||
|
|
return $sheets;
|
||
|
|
}
|
||
|
|
}
|