This package for setting commands in schedule.
DEPRECATED! MOVED TO: https://github.com/tkachikov/chronos
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);
}
// ...
}
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');
});
}
}
Visit route /route
, example: localhost:8000/pulse
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
{
// ...
}
For logging command messages and set status added trait PulseRunnerTrait
:
// ...
class TestCommand extends Command
{
use PulseRunnerTrait;
// ...
}
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:
For calculate statistics run commands you must create schedule for pulse:update-metrics
This package is open-sourced software licensed under the MIT license.