I think you should do that in the controller.
Excel::import(new ProductsImport, $request->file('file')->store('temp'));
return redirect()->back()->withSuccess('Imported Finish');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, i am using Laravel excel 3.1 on my Inertia vue project. I am creating import function for big file using chunksize, shouldqueue and withevent. Everything work fine now, but i need to tell the user ( frontend ) that the import process already finished. How to do that? I try using flash, session, return redirect. Everyting failed.
here are my code :
class ProductsImport implements
ToModel,
WithHeadingRow,
WithChunkReading,
WithValidation,
ShouldQueue,
WithEvents,
SkipsOnError,
SkipsOnFailure
{
use Importable, SkipsErrors, SkipsFailures, RegistersEventListeners;
public function __construct()
{
}
public function model(array $row)
{
// My code to store to db
}
public function rules(): array
{
// rules
}
public function chunkSize(): int
{
return 50;
}
public static function afterImport(AfterImport $event)
{
Log::info('Import Finish!)
// Here is what i want to type to tell user that the process already finished. how to do that?
}
}
Here are what i already tried :
using return redirect()->back()->withSuccess('Imported Finish');
or
Session::flash('success', 'Imported Finish');
or event
i try to return route('xxxxxxx')
Please or to participate in this conversation.