Replies: 2 comments 3 replies
-
I'd do the notification creation outside of the export job. And chain a job like shown in the example: https://docs.laravel-excel.com/3.1/imports/queued.html#appending-jobs Something like: $user = Auth::user();
$notification = new Notification();
$notification->user = $user->user_key;
$notification->creationdate = Carbon::now();
$notification->trackingimportprocessed = 0;
$notification->save();
Excel::queue($yourImport)->chain([
new NotifyUserOfCompletedImport($notification),
]) |
Beta Was this translation helpful? Give feedback.
2 replies
-
I'm several hours and can't find why it doesn't works for me. I changed as you suggested.
And my NotifyUserOfCompletedImport class:
But fails the job, and have no idea why does the select comparing id with all the values of all the fields of the notification object. Going crazy with this.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
On a project I'm working, I implemented queued imports. Job is generated and processed as expected and works fine, but I need to notify the user who uploaded the job. I created a Notifications table to store there when a user adds a new import, and needs, once the import finished, to change the bool finished field to true, problem is I can't see how because event is static and has any information about user logged or something like that.
This is my beforeImport event.
And works perfectly, but, this is my afterImport event.
This fails because "Trying to get property 'user_key' of non-object". I understand maybe I can do that, but I can't find any way to detect or pass as parameter or something, on afterImport, to do what I need to do.
On the other side, I don't understand why takes so much time and chunks for a 4 rows xlsx.
Beta Was this translation helpful? Give feedback.
All reactions