'Find model return null in redis queue
I have the following code
$user = new User([]);
$user->save();
event(new TestEvent($user->getKey()));
And in the TestEvent, I tried to get the user model from the key.
Log::info($this->key);
$user = User::find($this->key);
But for the first few times, the user return null even I still get the correct key in log.
I only use 1 DB in my project, and I do not use transaction when save the user
Can anyone help me to explain why this error happen.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
