Php 如何在运行链接作业后运行函数-laravel
我在拉维尔有一系列的工作Php 如何在运行链接作业后运行函数-laravel,php,laravel,jobs,Php,Laravel,Jobs,我在拉维尔有一系列的工作 public function sendTest($id) { $meo = $this->meoRepository->getMeo($id); Bus::chain([ new GprInsight($meo), new MeoDataGenerator($meo), new MailDigestReport($this->mailTaskRepository->
public function sendTest($id)
{
$meo = $this->meoRepository->getMeo($id);
Bus::chain([
new GprInsight($meo),
new MeoDataGenerator($meo),
new MailDigestReport($this->mailTaskRepository->getPendingMailTaskByMeoId($id), false),
])->onQueue('gmb')->dispatch();
}
这在第二次尝试后起作用,因为它在启动作业之前首先执行所有代码行,因此我的最后一个作业失败,因为我要发送给它的对象暂时为空,并且仅在执行了前两个作业后创建,我希望在第二个作业完成后执行最后一个作业,因为这大约需要4分钟。在第二份工作之后,我尝试了一个函数
public function sendTest($id)
{
$meo = $this->meoRepository->getMeo($id);
Bus::chain([
new GprInsight($meo),
new MeoDataGenerator($meo),
function ($id){
new MailDigestReport($this->mailTaskRepository->getPendingMailTaskByMeoId($id), false);
}
])->onQueue('gmb')->dispatch();
}
但是我得到了以下错误
[2020-11-10 06:48:42]本地。错误:无法解析依赖关系
类中的[参数#0[$id]]
App\Services\DigestReportService{“异常”:“[对象]
(Illumb\Contracts\Container\BindingResolutionException(代码:
0):无法解析中的依赖项[参数#0[$id]]
类App\Services\DigestReportService位于
D:\Programas\laragon\www\google places ranking\vendor\laravel\framework\src\light\Container\BoundMethod.php:180)
[stacktrace]
我怎样才能修好它