本文整理汇总了PHP中Illuminate\Console\Scheduling\Schedule::command方法的典型用法代码示例。如果您正苦于以下问题:PHP Schedule::command方法的具体用法?PHP Schedule::command怎么用?PHP Schedule::command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Console\Scheduling\Schedule
的用法示例。
在下文中一共展示了Schedule::command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')->hourly();
// 进入维护模式
$schedule->command('down')->evenInMaintenanceMode()->dailyAt('23:00');
//->when(function () {return true;});//
// 更新用户等级
$schedule->call(function () {
$registrations = Registration::where('state', 0)->where(function ($query) {
$query->where('registration_date', Carbon::yesterday()->toDateString());
})->get();
foreach ($registrations as $registration) {
$user = $registration->user;
$user->credit_level -= 1;
$user->save();
}
})->evenInMaintenanceMode()->daily();
//
// 重置rest_num
$schedule->call(function () {
$doctor_schedules = DocSchedule::where('state', 0)->where(function ($query) {
$week = [1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday', 7 => 'sunday'];
$query->where('doctoring_date', $week[Carbon::today()->dayOfWeek]);
})->get();
foreach ($doctor_schedules as $doctor_schedule) {
$doctor_schedule->rest_num = $doctor_schedule->total_num;
$doctor_schedule->save();
}
})->evenInMaintenanceMode()->dailyAt('3:00');
//
// 离开维护模式
$schedule->command('up')->evenInMaintenanceMode()->dailyAt('7:00');
//
}
示例2: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('proxy:check')->twiceDaily();
$schedule->command('proxy:fetch')->twiceDaily()->after(function () {
Artisan::call('proxy:security');
});
}
示例3: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')->hourly();
$schedule->command('backup:clean')->daily()->at('01:00');
$schedule->command('backup:run')->daily()->at('02:00');
$schedule->command('backup:monitor')->daily()->at('03:00');
}
示例4: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
//$schedule->command('inspire')
//->hourly();
$schedule->command('backup:database')->daily();
$schedule->command('backup:tidy')->dailyAt('1:00');
}
示例5: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$file = app_path() . '/../posts.out';
$schedule->command('vk:load_posts')->everyFiveMinutes()->sendOutputTo($file);
$file = app_path() . '/../review.out';
$schedule->command('vk:load_reviews')->hourly()->sendOutputTo($file);
}
示例6: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('routine:transfer-data')->everyMinute();
$schedule->command('routine:send-email')->dailyAt('11:00');
$schedule->command('routine:send-email')->dailyAt('17:00');
}
示例7: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('delete:jobs')->hourly();
$schedule->command('truncate:jobs')->dailyAt('23:00');
$schedule->command('check:OfficielEssai')->dailyAt('23:00');
$schedule->command('check:generateBillReduction')->dailyAt('23:00');
$schedule->command('GenarateBills:billsThreeMonths')->dailyAt('23:00');
$schedule->command('GenerateBills:ThreeMonthsNormal')->dailyAt('23:00');
$schedule->command('GenerateBills:SixMonths')->dailyAt('23:00');
$schedule->command('GenerateBills:SixMonthsNormal')->dailyAt('23:00');
$schedule->command('Manage:years')->daily();
$schedule->command('nextyear:current')->daily();
/* $schedule->command('log:demo')->daily()->when(function(){
if(Carbon::now()->toDateString() == Carbon::now()->startOfMonth()->toDateString())
{
return true;
}
});*/
/*$schedule->command('log:demo')->everyMinute()->when(function(){
if(Carbon::now()->toDateString() == Carbon::now()->toDateString())
{
return true;
}
});*/
// $schedule->command('inspire') ->hourly();
//$schedule->command('log:demo')->monthly();
}
示例8: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')->hourly();
$schedule->command('sms:update');
$schedule->command('sms:push');
// $schedule->command('queue:listen');
}
示例9: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
if (env('APP_ENV') != 'local') {
$schedule->command('rets:properties --function=pull')->dailyAt('13:00')->withoutOverlapping();
$schedule->command('rets:properties --function=remove')->dailyAt('14:00')->withoutOverlapping();
}
}
示例10: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('snipeit:inventory-alerts')->daily();
$schedule->command('snipeit:expiring-alerts')->daily();
$schedule->command('snipeit:backup')->weekly();
$schedule->command('backup:clean')->daily();
}
示例11: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// Backups.
$schedule->command('backup:run --only-db')->cron('50 * * * * *');
$schedule->command('backup:clean')->daily()->at('02:30');
$schedule->command('backup:monitor')->daily()->at('04:30');
}
示例12: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')->hourly();
$schedule->command('dataSourceVancouverIslandWeather')->everyMinute();
$schedule->command('zoomLevelTuning')->everyMinute();
$schedule->command('databaseCleaning')->hourly();
}
示例13: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('poller:ping')->everyFiveMinutes();
$schedule->command('poller:snmp')->everyFiveMinutes();
$schedule->command('poller:port')->everyFiveMinutes();
$schedule->command('poller:port --interval=daily --status=A')->daily();
}
示例14: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
/* LIST OF HELPER FUNCTION CAN BE FOUND IN htdocs/laravel/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php */
/* You need to register single laravel cron on server that runs every minute, checks for any Scheduled command and run them */
/* Single laravel cron to be registered on server "* * * * * php htdocs/laravel/artisan schedule:run >> /dev/null 2>&1" */
$schedule->command('laracasts:clear-history')->monthly()->thenPing('url');
// Scheduling Artisan command, run "php artisan laracasts:clear-history" command every month and ping a specific URL.
//
// In order to "emailOutputTo", you should first "sendOutputTo" to save the output to be emailed
$schedule->command('laracasts:clear-history')->monthly()->sendOutputTo('path/to/file')->emailOutputTo('email@me.com');
// Scheduling Artisan command, run "php artisan laracasts:clear-history" command every month, save output to a specific file and email that output to a specific email.
$schedule->command('laracasts:clear-history')->monthly()->sendOutputTo('path/to/file');
// Scheduling Artisan command, run "php artisan laracasts:clear-history" command every month and save output to a specific file
$schedule->command('laracasts:clear-history')->monthly();
// Scheduling Artisan command, run "php artisan laracasts:clear-history" command every month
$schedule->command('laracasts:daily-report')->dailyAt('23:55');
// Scheduling Artisan command, run "php artisan laracasts:daily-report" command every day at "23:55"
//$schedule->exec('touch foo.txt')->dailyAt('10:30'); // Scheduling Execution command, create "foo.txt" file every day at "10:30"
//$schedule->exec('touch foo.txt')->daily(); // Scheduling Execution command, create "foo.txt" file every day
//$schedule->exec('touch foo.txt')->everyFiveMinutes(); // Scheduling Execution command, create "foo.txt" file every five minutes
/*
* $schedule->command('inspire')
->hourly(); // Scheduling Artisan command, run "php artisan inspire" every hour
*/
}
示例15: schedule
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
{
/**
* Create the schedule based upon what is in the `harvests` table
*/
try {
$harvests = Harvest::all();
foreach ($harvests as $harvest) {
/**
* Both ping_before_url and then_ping_url could be NULL
* in the database but things will fail silently if NULL
* is passed to pingBefore() or thenPing().
*
* This still assumes that if there is a value that it
* is both valid and GET-able. If either is not a valid
* URL or that URL does not return a response a silent
* failure could still occur.
*/
if ($harvest->ping_before_url !== null && $harvest->then_ping_url !== null) {
$schedule->command('harvest:update ' . $harvest->resource . ' --action=' . $harvest->action)->{$harvest->scheduler_frequency_method}()->withoutOverlapping()->pingBefore($harvest->ping_before_url)->thenPing($harvest->then_ping_url);
} elseif ($harvest->ping_before_url !== null && $harvest->then_ping_url === null) {
$schedule->command('harvest:update ' . $harvest->resource . ' --action=' . $harvest->action)->{$harvest->scheduler_frequency_method}()->withoutOverlapping()->pingBefore($harvest->ping_before_url);
} elseif ($harvest->ping_before_url === null && $harvest->then_ping_url !== null) {
$schedule->command('harvest:update ' . $harvest->resource . ' --action=' . $harvest->action)->{$harvest->scheduler_frequency_method}()->withoutOverlapping()->thenPing($harvest->then_ping_url);
} else {
// Both are null
$schedule->command('harvest:update ' . $harvest->resource . ' --action=' . $harvest->action)->{$harvest->scheduler_frequency_method}()->withoutOverlapping();
}
}
} catch (\Exception $e) {
// Hopefully we are only here because we are migrating,
// which does not like the database query above.
}
}