1

1 year agoby Zawnaing

How to use laravel queue for excel import

I used laravel excel version 3.1 and laravel version 5.6.I have 100000 row of excel data.I used laravel excel documentation guide. But loading time is so long.How can i do that.

1

Zawnaing replied 1 year ago

0

my fertlizerImportImport.php

public function handle() {
 Excel::import($this->import, $this->file);
 }

1

Zawnaing replied 1 year ago

0

in controller

$import = new FertilizerImport();
	$file = request()->file('fertilizer_import');
	dispatch(new fertilizerImportJob($import, $file));

1

Zawnaing replied 1 year ago

0

I want to import excel file into my database. one row is enter in jobs table in my database when i uploaded my excel file.Then, I run php artisan queue:work .It work processing in my terminal but data is not enter my fertilizer table.

91

Sarthak Shrivastava replied 1 year ago

0

You need to create event and listener for your task.

As you want to export lots of data, try to dispatch an event and pass your data. Then on listener of that event, you run your export task.

But important point is to make your event queue by implementing ShouldBroadcast.

For more details on queue of event check this link

Ask Question
Most Visited
Categories