定制 tkachikov/laravel-pulse 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tkachikov/laravel-pulse

最新稳定版本:2.0.6

Composer 安装命令:

composer require tkachikov/laravel-pulse

包简介

Settings commands for scheduling

README 文档

README

License: MIT

This package for setting commands in schedule.

DEPRECATED! MOVED TO: https://github.com/tkachikov/chronos

Installation

Require this package with composer using the following command

composer require tkachikov/laravel-pulse

Run Laravel pulse command for install:

php artisan pulse:install

Added Laravel pulse scheduler in app/Console/Kernel.php:

// ...
use Tkachikov\LaravelPulse\Services\ScheduleService;

// ...
class Kernel extends ConsoleKernel
{
    // ...
    protected function schedule(Schedule $schedule): void
    {
        app(ScheduleService::class)->schedule($schedule);
    }
    // ...
}

Authorization

For authorization in production set statements in app/Providers/LaravelPulseServiceProvider, example:

// ...
class LaravelPulseServiceProvider extends LaravelPulseApplicationServiceProvider
{
    // ...
    protected function gate(): void
    {
        Gate::define('viewPulse', function ($user) {
            return $user->hasRole('admin');
        });
    }
}

Usage

Visit route /route, example: localhost:8000/pulse

For testing

Open pulse:test command: Open test

Run pulse:test command: Run test

Run attributes

If you need off run command from Laravel Pulse dashboard (notRunInManual) or schedules (notRunInSchedule) set attributes:
For example all off:

// ...
#[notRunInManual]
#[notRunInSchedule]
class TestCommand extends Command
{
    // ...
}

Logging and states

For logging command messages and set status added trait PulseRunnerTrait:

// ...
class TestCommand extends Command
{
    use PulseRunnerTrait;
    // ...
}

Create schedules

Open your command and set params for it in Create schedule and save. Create schedule

For off command click button edit, check to off Run and save: Off schedule

Statistics

For calculate statistics run commands you must create schedule for pulse:update-metrics

License

This package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-15