#laravel-excel : how to download more than 100,000 data

2 messages · Page 1 of 1 (latest)

thick tinsel
#

I have this query it's working but only 22,000 plus data was able to download.. how about 50,000 to 100,000 data?

class PvpExport implements FromQuery, WithHeadings, ShouldAutoSize, WithMapping, WithStyles, WithChunkReading
{
    use Exportable;

    private string $writerType = Excel::XLSX;

    protected $startDate;
    protected $endDate;
    protected $mode;

    public function __construct($startDate, $endDate, $mode)
    {
        $this->startDate = $startDate;
        $this->endDate = $endDate;
        $this->mode = $mode;
    }


    public function query()
    {
        $query = Pvp::query();

        if ($this->mode !== 'all') {
            $query->where('type', $this->mode);
        }

        if ($this->startDate) {
            $query->where('created_at', '>=', $this->startDate);
        }

        if ($this->endDate) {
            $query->where('created_at', '<=', $this->endDate);

        }

        return $query;
    }


    public function map($row): array
    {
        return [
            $row['id'],
            $row['match_id'],
            $row['player_id_1'],
            $row['player_id_2'],
            $row['winner_id'],
            $row['room_id'],
            $row['type'],
            $row['rake'],
            $row['player_1_level_1_id'],
            $row['player_1_level_2_id'],
            $row['player_2_level_1_id'],
            $row['player_2_level_2_id'],
            $row['player_1_level_1_commission'],
            $row['player_1_level_2_commission'],
            $row['player_2_level_1_commission'],
            $row['player_2_level_2_commission'],
            $row['gold_reward'],
            $row['mmr'],
            $row['mmr_enabled'],
            $row['ends_at'],
            $row['disbursement_completed_at'],
            $row['waiting_time'],
        ];
    }



    public function chunkSize(): int
    {
        return 5000;
    }


}
winter wraith
#

I already answered your question. #1166944506529193995 message