tkachikov / laravel-pulse
Settings commands for scheduling
Requires
- php: ^8.1
- tkachikov/laravel-withtrashed: ^1.0
- tkachikov/memory: ^1.2
README
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
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.
For off command click button edit, check to off Run
and save:
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.