问题在于侦听器有时(很少)会收到错误的用户数据,并且用户ID上的1会比需要的用户更高级。用户id = 15662必须更改,但已处理15663。这怎么可能?如何处理?
QUEUE_DRIVER = rabbitmq
更新控制器中的模型:
Auth :: user()-> email = $ request-> new_email; Auth :: user()-> save();
=====
我在用户模型中添加了$ dispatchesEvents
protected $dispatchesEvents = [
'updated' => UserUpdated::class
];
事件UserUpdated:
class UserUpdated
{
use SerializesModels;
public $user;
/**
* Create a new event instance.
*
* @param User $user
*/
public function __construct(User $user)
{
$this->user = $user;
}
}
UserUpdatedListener:
public function handle(UserUpdated $event)
{
....
}