日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Laravel Scheduling Package

發布時間:2025/6/16 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Laravel Scheduling Package 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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); 歡迎大家 star 和提交 issue :) Laravel & VUE & 小程序 & 電商產品 交流群:674454674 暗號:segmentfault

總結

以上是生活随笔為你收集整理的Laravel Scheduling Package的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。