PHP code example of diontech / laravel-extended-scheduler
1. Go to this page and download the library: Download diontech/laravel-extended-scheduler library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
diontech / laravel-extended-scheduler example snippets
\DionTech\Scheduler\Support\Facades\ScheduledCommand\ScheduledCommand::arguments([
'foo'
])->fluent([
'cron' => [
'* * * * *'
]
])->isActive()
->create();
\DionTech\Scheduler\Models\ScheduledCommand::create([
'method' => 'command',
'arguments' => [
'schedule:list'
],
'fluent' => [
'cron' => ['* * * * *']
],
'is_active' => true
]);
\DionTech\Scheduler\Models\ScheduledCommand::create([
'method' => 'command',
'arguments' => [
'foo'
],
'fluent' => [
'weekdays',
'hourly',
'timezone' => ['America/Chicago'],
'between' => ['8:00', '17:00']
],
'is_active' => true
]);
\DionTech\Scheduler\Models\ScheduledCommand::create([
'method' => 'command',
'arguments' => [
'test:command',
['Taylor', '--force']
],
'fluent' => [
'daily'
],
'is_active' => true
]);
\DionTech\Scheduler\Models\ScheduledCommand::create([
'method' => 'job',
'arguments' => [
'new \App\Jobs\TestJob', 'sqs'
],
'fluent' => [
'everyFiveMinutes'
],
'is_active' => true
]);
$model = \DionTech\Scheduler\Models\ScheduledCommand::create([
'method' => 'command',
'arguments' => [
'foo'
],
'fluent' => [
'weekdays',
'hourly',
'timezone' => ['America/Chicago'],
'between' => ['8:00', '17:00']
],
'is_active' => true
]);
$event = $model->event(); //returns \Illuminate\Console\Scheduling\Event
$command = $event->command; //something like "/usr/local/Cellar/[email protected] /7.4.16/bin/php' 'artisan' foo"
$expression = $event->expression; //something like "0 * * * 1-5"
$description = $event->description; //something like "new \App\Jobs\TestJob"
$commands = (new \DionTech\Scheduler\Support\Helper\CommandLister)->all();
return (new \DionTech\Scheduler\Http\Responses\ListAllCommandsResponse())
->toResponse($request);
shell
php artisan migrate