Answer the question
In order to leave comments, you need to log in
How to properly organize tasks in a queue?
The task is this:
Scrap CSV, an array of arrays is obtained.
After parsing, from this data it is necessary to create a model - Platform, then for each Platform take the API data and create SubModels with this data.
$platforms = array;
GetDataFromApi::dispatch($platforms);
GetDataFromApi::dispatch($platforms)
foreach ($platforms as $platform) {
GetDataForPlatform::dispatch($platform);
}
Answer the question
In order to leave comments, you need to log in
it is best to use events
, we
hang the listener on the Platform created event, add a condition to the listener under which it will work (in case, for example, some type of platform does not need to be pulled from the side) and as soon as we add it to the Platform base, it itself pushes the listener with the necessary functionality.
The event-subscriber model is generally very convenient to use almost everywhere.
laravel.com#events
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question