Answer the question
In order to leave comments, you need to log in
What is the best way to create a conditional id when creating a model through a queue in Laravel?
Good day.
I write api on laravel 5.7. for self-development
It accepts an image and width and height parameters as input, queues a task to save the image and its data in the images table, returns a conditional identifier by which you can get the status or a link to the image.
Now for the conditional identifier I simply use the queue id, writing it to the images table
Question: is it possible to somehow get the id of the object being created in the images table at the time the job was added to the queue?
Answer the question
In order to leave comments, you need to log in
No, you can’t, come up with a hash, let it be a name, then when creating a queue, you pass this hash to it, and then you get this image from it, you can’t get an ID before the record is created
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question