zoukankan      html  css  js  c++  java
  • Laravel Scheduling Package

    Laravel 是在 AppConsoleKernel 类中的 schedule 方法去定义所有的调度任务。

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

    所以我们开发了此包,用来把各个模块的调度任务放在自己的包里,而不是全部放在 AppConsoleKernel 类的 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:

    iBrandSchedulingServiceProvider::class,


    Usage

    
    

    extend Scheduling abstract class

    use iBrandSchedulingScheduling;
    
    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(iBrandSchedulingScheduleList::class)->add(YourSchedule::class); 

    讨论交流

    联系我们

  • 相关阅读:
    抽象工厂模式
    工厂方法模式
    assert断言
    非日志警告
    requests获取所有状态码
    在线工具、资料
    重定向、feed输出:控制台输出的内容存放到文件
    正则表达式python
    python提取相对路径
    logger类
  • 原文地址:https://www.cnblogs.com/iBrand2018/p/8515513.html
Copyright © 2011-2022 走看看