Download the PHP package mrpunyapal/laravel-auth-jobs without Composer
On this page you can find all versions of the php package mrpunyapal/laravel-auth-jobs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mrpunyapal/laravel-auth-jobs
More information about mrpunyapal/laravel-auth-jobs
Files in mrpunyapal/laravel-auth-jobs
Package laravel-auth-jobs
Short Description This package allows you to access the authenticated user while processing jobs in the queue.
License MIT
Homepage https://github.com/mrpunyapal/laravel-auth-jobs
Informations about the package laravel-auth-jobs
This package allows you to access the authenticated user while processing jobs in the queue.
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Usage
This package provides two middleware: AuthenticateJob, you can add this middleware to your job class. and you can now access auth()->user() in your job class.
Job Class
Customizing Context Keys
If you need to use custom context keys (e.g., to avoid conflicts with other packages), you can create your own class implementing HasContextKeys:
Then update your config:
Alternatively, you can bind your implementation directly in a service provider:
Laravel Boost
If your application uses Laravel Boost, this package ships a third-party skill that helps AI agents wire AuthenticateJob, verify middleware group configuration, customize HasContextKeys, and debug missing auth context inside queued jobs.
After requiring this package, install or refresh Boost resources in your application:
When Boost prompts for third-party packages, include mrpunyapal/laravel-auth-jobs so it can install the laravel-auth-jobs-development skill into your selected agent's skills directory.
Use Cases
- Authorization: Authorize actions in your job class based on the authenticated user's permissions.
- User Context: Access the authenticated user's data within jobs to perform user-specific operations.
- Role-Based Processing: Execute different logic in your jobs based on the user's roles or permissions.
- Personalization: Apply user preferences and settings during job execution for customized processing.
- Audit Trail: Create comprehensive audit logs that include user information, improving traceability and accountability.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Punyapal Shah
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-auth-jobs with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^12.0||^13.0