承接 rushing/laravel-schedule-runs 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rushing/laravel-schedule-runs

最新稳定版本:1.0

Composer 安装命令:

composer require rushing/laravel-schedule-runs

包简介

Track when the last time a task/command/whatever was executed.

README 文档

README

Inspired by (Tofandel's Stack Overflow response)[https://stackoverflow.com/a/73554077]. Packagaed for reusability.

Install

composer require rushing/laravel-schedule-runs
php artisan schedule-runs:install

Usage

Use the trait on one of your commands.

class MyCommand {
    use \Rushing\ScheduleRuns\Traits\HasScheduleRuns;

    protected $signature = 'app:my-command {--since=}';

    public function getScheduleRunHandle()
    {
        // The class name is used by default in the trait, but you can override here.
        return static::class;
    }

    public function handle()
    {
        $query = MyModel::query();

        // Get the last schedule run
        $this->getLastScheduleRun();

        // Modify a query to get items created or updated after the last schedule run. Optionally, pass an override parameter.
        $this->scopeWhereLastScheduleRun($query, ['created_at', 'updated_at'], '>=', $this->option('since'));

        // Clear the history
        $this->scheduleRuns()->delete(); // or each->delete() if you want to fire the model events.

        // Set the last run time, optionally with extra data attached.
        $this->setLastScheduleRun(now(), [
            'whatever' => 'you want'
        ]);
    }
}

统计信息

  • 总下载量: 1.01k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-03-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固