123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Console\Commands\User;
- use App\Modules\Book\Models\NovelUserPorperty;
- use Illuminate\Console\Command;
- class CreateDropTable extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'create_drop_table';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '每天删除新建表';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- NovelUserPorperty::dropTable();
- for ($i = 0; $i < 3; $i++) {
- if ($i) {
- $date = date('Ymd', strtotime('+' . $i . ' days'));
- } else {
- $date = date('Ymd');
- }
- NovelUserPorperty::model($date)->createTableIfNotExists();
- }
- }
- }
|