Kernel.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Console;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
  5. use Illuminate\Support\Facades\Storage;
  6. class Kernel extends ConsoleKernel
  7. {
  8. /**
  9. * The Artisan commands provided by your application.
  10. *
  11. * @var array
  12. */
  13. protected $commands = [
  14. Commands\ChargeCreditsCommand::class,
  15. Commands\ChargeServers::class,
  16. ];
  17. /**
  18. * Define the application's command schedule.
  19. *
  20. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  21. * @return void
  22. */
  23. protected function schedule(Schedule $schedule)
  24. {
  25. $schedule->command('servers:charge')->everyMinute();
  26. $schedule->command('cp:versioncheck:get')->daily();
  27. //log cronjob activity
  28. $schedule->call(function () {
  29. Storage::disk('logs')->put('cron.log', 'Last activity from cronjobs - '.now());
  30. })->everyMinute();
  31. }
  32. /**
  33. * Register the commands for the application.
  34. *
  35. * @return void
  36. */
  37. protected function commands()
  38. {
  39. $this->load(__DIR__.'/Commands');
  40. require base_path('routes/console.php');
  41. }
  42. }