CreateActivityCommand.php 1001 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Console\Commands\Goodnight;
  3. use App\Models\Goodnight\ActivityModel;
  4. use Illuminate\Console\Command;
  5. class CreateActivityCommand extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'goodnight:activity';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = '晚安伴侣:创建活动';
  19. /**
  20. * Create a new command instance.
  21. *
  22. * @return void
  23. */
  24. public function __construct()
  25. {
  26. parent::__construct();
  27. }
  28. /**
  29. * Execute the console command.
  30. *
  31. * @return mixed
  32. */
  33. public function handle()
  34. {
  35. ActivityModel::create([
  36. 'opened_at' => mktime(19, 0, 0),
  37. 'closed_at' => mktime(19, 0, 0) + 24 * 60 * 60,
  38. 'showed_at' => mktime(20, 0, 0) + 24 * 60 * 60,
  39. 'end_at' => mktime(0, 0, 0) + 3 * 60 * 60
  40. ]);
  41. }
  42. }