command('inspire') // ->hourly(); $schedule->call(function () { $begin = Carbon::today()->toDateTimeString(); $end = Carbon::tomorrow()->toDateTimeString(); Log::info('定时器已经执行'); $items = CheckCard::where([ ['begin_date_time', '>=', $begin], ['begin_date_time', '<', $end], ])->whereNull('end_date_time')->get(); foreach($items as $item) { $item->end_date_time = Carbon::createFromTimestamp(strtotime($item->begin_date_time))->addHours(2)->toDateTimeString(); $item->save(); } })->dailyAt('13:30'); } /** * Register the Closure based commands for the application. * * @return void */ protected function commands() { require base_path('routes/console.php'); } }