当前位置: 移动技术网 > IT编程>开发语言>PHP > Laravel Scheduling Package

Laravel Scheduling Package

2018年03月22日  | 移动技术网IT编程  | 我要评论

迅雷电影下载网站,求一个能看片的网站,杰啊教你说闽南语

Laravel 是在 App\Console\Kernel 类中的 schedule 方法去定义所有的调度任务。

iBrand 产品作为一个电商类产品,本身业务需求非常庞大和复杂,全部定义在 schedule 方法中会非常臃肿。而且 iBrand 产品的每个模块都是一个 Package,具有高度的复用性。

所以我们开发了此包,用来把各个模块的调度任务放在自己的包里,而不是全部放在 App\Console\Kernel 类的 schedule 方法中。

github: ibrandcc/laravel-scheduling

 

Installation

$ composer require ibrand/laravel-scheduling -vvv

If your Laravel version below 5.5, you need add the follow line to the section providers of config/app.php:

iBrand\Scheduling\ServiceProvider::class,


Usage


extend Scheduling abstract class

use iBrand\Scheduling\Scheduling;

class YourSchedule extends Scheduling {

    public function schedule(){
        
        //Your schedule logic.
        $this->schedule->call(function () {
        
        })->daily();
    }
} 

register


Add follow line to you ServiceProvider register method.


$this->app->make(iBrand\Scheduling\ScheduleList::class)->add(YourSchedule::class);

 

 







                    

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网