在 Laravel 5.1 中完成后如何捕获作业队列详细信息?
问题描述
在 Laravel 5.1 中,我希望在作业完成时收到通知,以及有关作业的详细信息(特别是 user_id
和 customer_id
).我在 AppServiceProvider
中使用 Queue::after
方法方法作为 Laravel 建议.
In Laravel 5.1, I would like to be notified when a job is completed, with details about the job (specifically, the user_id
, and customer_id
). I'm using the Queue::after
method method in the AppServiceProvider
as Laravel suggests.
如果像这样转储 $data
参数:
If a dump the $data
parameter like so:
我得到以下信息:
data
数组包含我所追求的 user_id
和 customer_id
.这是伟大的.但是我如何解析这个响应来提取这些信息.
The data
array contains both of the user_id
and the customer_id
that I'm after. Which is great. But how do I parse this response to pull that information out.
我唯一的想法是使用正则表达式.但我想我会检查一下是否有更好的方法?
My only thought is to use regex. But I thought I'd check to see if there was a better way?
推荐答案
对于 Laravel 5.2:
For Laravel 5.2:
这篇关于在 Laravel 5.1 中完成后如何捕获作业队列详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!