syamsoul / laravel-action-delay
Delay a Job, Database Query or PHP code at a specific datetime easily with one simple command.
Installs: 66
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 2
Type:laravel-package
Requires
- php: >=8.0.0
- haydenpierce/class-finder: ^0.5.3
- illuminate/bus: ^10.0|^11.0
- illuminate/console: ^10.0|^11.0
- illuminate/contracts: ^10.0|^11.0
- illuminate/queue: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
README
Introduction
This package allows you to delay an action (Jobs, Database Query, PHP Code or External Process) at specific datetime with a simple command.
Requirement
- Laravel 10.x (and above)
Installation
This package can be used in Laravel 10.x or higher. If you are using an older version of Laravel, there's might be some problem. If there's any problem, you can create new issue and I will fix it as soon as possible.
You can install the package via composer:
composer require syamsoul/laravel-action-delay
Usage
You can delay an action via Artisan
command.
php artisan souldoit:action-delay
Example
1. Delay Laravel Jobs
What action you want to delay? [Laravel Jobs]: [1] Laravel Jobs [2] Database Query [3] PHP Code [4] External Process > 1 What job you want to delay? [App\Jobs\GenerateCertificate]: [1] App\Jobs\GenerateCertificate [2] App\Jobs\SendCongratulationsEmail > 2 Please insert #1 parameter: `user` (Type: App\Models\User): > \App\Models\User::find(1) Please insert #2 parameter: `text` (Type: string): > Congratulations on your success! What time to execute (in UTC time, format:Y-m-d H:i:s): > 2024-06-01 10:16:00
2. Delay Database Query
What action you want to delay? [Laravel Jobs]: [1] Laravel Jobs [2] Database Query [3] PHP Code [4] External Process > 2 Enter MySQL query: > UPDATE `variables` SET `_value`='false' WHERE `_key`='maintainance_mode_enabled' What time to execute (in UTC time, format:Y-m-d H:i:s): > 2024-06-01 08:30:35
3. Delay PHP Code
What action you want to delay? [Laravel Jobs]: [1] Laravel Jobs [2] Database Query [3] PHP Code [4] External Process > 3 Enter PHP code: > \App\Models\Variable::where('_key', 'maintainance_mode_enabled')->update(['_value' => 'false']); \App\Models\Variable::where('_key', 'new_feature_enabled')->update(['_value' => 'true']); What time to execute (in UTC time, format:Y-m-d H:i:s): > 2024-06-01 08:30:35
4. Delay External Process
What action you want to delay? [Laravel Jobs]: [1] Laravel Jobs [2] Database Query [3] PHP Code [4] External Process > 4 Enter command: > sh deploy Process timeout [600]: #default is 600 seconds, enter to choose default value > What time to execute (in UTC time, format:Y-m-d H:i:s): > 2024-06-01 08:30:35
Support me
If you find this package helps you, kindly support me by donating some BNB (BSC) to the address below.
0x364d8eA5E7a4ce97e89f7b2cb7198d6d5DFe0aCe
License
The MIT License (MIT). Please see License File for more information.