geetpurwar
3 months ago

Using Middleware in Dispatching Queue

Posted 3 months ago by geetpurwar

Hi,

I need a bit of help here. I am using following function which seems fine with using middleware.

Route::get('push', function(){
    $product = \App\Product::find(5028);
    $product->shopify_upload();
    return "Done";
})->middleware('dConfig');

However, I need to dispatch this via queue job and this is providing me error as I am not able to use middleware in jobs.

Route::get('push', function(){
    PushProductToShopify::dispatch(5029)->delay(now()->addSeconds(1));
})->middleware('dConfig');

Anyone please suggest how do I use middleware in queues. Thanks.

Please sign in or create an account to participate in this conversation.