diff --git a/CHANGELOG.md b/CHANGELOG.md index 782a714..5954dbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ # Changelog All notable changes to `laravel-queueable-auth-context` will be documented in this file. + +## v1.0 - 2025-07-10 + +**Full Changelog**: https://github.com/datpmwork/laravel-auth-queue/commits/v1.0 diff --git a/src/LaravelAuthQueueServiceProvider.php b/src/LaravelAuthQueueServiceProvider.php index 053ecf1..adb7406 100644 --- a/src/LaravelAuthQueueServiceProvider.php +++ b/src/LaravelAuthQueueServiceProvider.php @@ -3,17 +3,24 @@ namespace DatPM\LaravelAuthQueue; use Illuminate\Queue\Queue; +use Illuminate\Queue\SyncQueue; use Illuminate\Support\Facades\Auth; use Illuminate\Support\ServiceProvider; use DatPM\LaravelAuthQueue\Guards\KernelGuard; use Illuminate\Contracts\Database\ModelIdentifier; use DatPM\LaravelAuthQueue\Traits\WasAuthenticated; +use Illuminate\Support\Facades\Queue as QueueManager; class LaravelAuthQueueServiceProvider extends ServiceProvider { public function boot() { Queue::createPayloadUsing(function ($connectionName, $queue, $payload) { + // Ignore adding extra payload for Sync Queue + if (QueueManager::connection($connectionName) instanceof SyncQueue) { + return []; + } + // Skip attaching authUser when the job does not use WasAuthenticated Trait if (! in_array(WasAuthenticated::class, class_uses_recursive($payload['displayName']))) { return []; diff --git a/src/Middlewares/RestoreAuthenticatedContextMiddleware.php b/src/Middlewares/RestoreAuthenticatedContextMiddleware.php index adddc9c..a2cec7c 100644 --- a/src/Middlewares/RestoreAuthenticatedContextMiddleware.php +++ b/src/Middlewares/RestoreAuthenticatedContextMiddleware.php @@ -2,6 +2,7 @@ namespace DatPM\LaravelAuthQueue\Middlewares; +use Illuminate\Queue\Jobs\SyncJob; use Illuminate\Support\Facades\Auth; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Auth\Authenticatable; @@ -12,6 +13,11 @@ class RestoreAuthenticatedContextMiddleware public function handle($command, callable $next) { + // If the job is being handled in sync, skip restore logic + if ($command->job instanceof SyncJob) { + return $next($command); + } + Auth::shouldUse('kernel'); $guard = auth(); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy