show timeout when try to export large data in excel using laravel

I am trying to export more than 10k data in my excel but it show time out or sometime show not reached. What is the best process to export large amount of data in excel. In the i gave mtycontroller and export code.


function excel(){
return (new UsersExport())->download('invoices.xlsx');

in the Export folder UsersExport.php file


namespace AppExports;

use AppModelsTEST;
use MaatwebsiteExcelConcernsFromCollection;
use MaatwebsiteExcelConcernsExportable;
use MaatwebsiteExcelConcernsFromQuery;
use MaatwebsiteExcelConcernsWithHeadings;
use MaatwebsiteExcelConcernsWithMapping;
use MaatwebsiteExcelConcernsFromArray;
use IlluminateContractsQueueShouldQueue;

class UsersExport implements FromQuery, WithMapping, WithHeadings,ShouldQueue
* @return IlluminateSupportCollection
use Exportable;

public function query()
return TEST::query()->where('status_id','!=','12');

public function headings(): array
return [
'test Id', 'test Tracking Id','test Type','customer name', 'Receiver Info','Pickup','Delivery','cash','Charge','Status','cash Payment','Paid By','Request Time','Pickup Time','Delivery Time','Time Duration'

public function map($row): array
if($row->delivery == '0' || empty($row->delivery)){
$delivery = (!empty($row->branch->name)?$row->branch->name:'Not Available');
$delivery=(!empty(AppModelsBranch::find($row->delivery)->name)?AppModelsBranch::find($row->delivery)->name:'Not Available');

$picks =AppModelsTestLog::where('courier_id',$row->id)->where('status_id','13')->first();
return [
!empty($row->customer->name)?$row->customer->name:"Not Available",
$row->receiver_name.'-- '. $row->receiver_address .'-- '.$row->receiver_phone,
!empty($row->pickup->name)?$row->pickup->name:"Not Available",
!empty($delivery)?$delivery:"Not Available",
date('d-m-Y h:i A',strtotime($row->created_at)),
!empty($picks->created_at)?date('d-m-Y h:i A',strtotime($picks->created_at)):"Not Available",
!empty($row->delivery_date)?date('d-m-Y h:i A',strtotime($row->delivery_date)):"Not Available",

Code is ok. it exports data when it has less amount of data but its occur problem when it’s time to export large amount of data. Please if anyone can suggest how can i solved this when it’s time to export large data

from Newest questions tagged laravel-5 – Stack Overflow

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.