ddaproduction / evocms-queue
0.0.3
2021-03-30 09:25 UTC
Requires
- illuminate/bus: 8.*
- illuminate/encryption: 8.*
- illuminate/queue: 8.*
This package is auto-updated.
Last update: 2024-09-11 14:27:23 UTC
README
该包添加了使用队列的功能,类似于laravel,但除了dispatchable特性中的方法外。
dispatchIf
dispatchUnless
dispatchSync
dispatchNow
dispatchAfterResponse
dispatchAfterResponse
withChain
安装
- php artisan package:install require ddaproduction/evocms-queue "*"
- php artisan vendor:publish --provider="EvolutionCMS\EvocmsQueue\EvocmsQueueServiceProvider"
- php artisan queue:table
- php artisan queue:failed-table
- php artisan migrate
配置
配置文件位于 core/custom/config/queue.php 文件夹中
使用方法
创建任务
- 在您方便的位置创建一个类,例如在包的 jobs 文件夹中。
- 继承自 EvolutionCMS\EvocmsQueue\AbstractJob。示例
<?php namespace EvolutionCMS\Main\Jobs; use EvolutionCMS\EvocmsQueue\AbstractJob; use Illuminate\Queue\InteractsWithQueue; class Foo extends AbstractJob { use InteractsWithQueue; /** * Execute the job. */ public function handle() { // do something } }
将任务添加到队列
$q = evo()->make('queue'); $q->push(new Foo());
或
\Illuminate\Support\Facades\Queue::push(new \EvolutionCMS\Main\Jobs\Foo());