Replies: 1 comment
-
I moved this to a discussion as it's more of a question and less of an issue. To answer your question, dispatch a custom request and store the model (or model ID) inside the request's meta data. You can then access this meta data via the Something like this: public function parse(Response $response): Generator
{
// process the response...
$request = (new Request('GET', $url, [$this, 'getModels']))
->withMeta('modelId', $brand->id);
yield ParseResult::fromValue($request);
}
public function getModels(Response $response): Generator
{
$model = Brand::find($response->getRequest()->getMeta('modelId'));
// ...
} |
Beta Was this translation helpful? Give feedback.
0 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
How to pass custom object from one method to another.
For example in first method (parse) I grab collection of items and in for each loop I added new entry to DB and create eloquent object. Next I would like to for each element call another request and parse in another method but I need to pass Object to that parse method as well.
How can I do it?
Beta Was this translation helpful? Give feedback.
All reactions