我想在队列处理后运行一些语句,但 Queue::after 块没有被执行,谁能帮我如何运行 Queue::after 块
<?php
namespace test\Providers;
use Log;
use Queue;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Log::info('log1');
Queue::after(function ($connection, $job, $data) {
Log::info('log2');
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
}
示例输出:在 laravel.log 中:仅“log1”打印