| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 | <?phpnamespace App\Console\Commands\Tool;use Illuminate\Console\Command;use Illuminate\Support\Facades\Schema;use Illuminate\Database\Schema\Blueprint;class createTable extends Command{    /**     * The name and signature of the console command.     *     * @var string     */    protected $signature = 'createtable';    /**     * The console command description.     *     * @var string     */    protected $description = 'create table';    /**     * Create a new command instance.     *     * @return void     */    public function __construct()    {        parent::__construct();    }    /**     * Execute the console command.     *     * @return mixed     */    public function handle()    {        $this->createUserSignTable();        //$this->createAdVisitTable();    }    private function createUserSignTable(){        $next_month = date('Ym',strtotime('next Month'));        $sign_table = 'user_sign'.$next_month;        if (!Schema::hasTable($sign_table)) {            Schema::create($sign_table, function (Blueprint $table) {                $table->increments('id');                $table->integer('uid');                $table->integer('price');                $table->date('day');                $table->integer('sign_time');                $table->dateTime('created_at');                $table->dateTime('updated_at');                $table->index('uid','ink_uid');                $table->index(['uid','sign_time'],'uid_sign_time');            });        }        $next_next_month = date('Ym',strtotime('+2 Month'));        $sign_table = 'user_sign'.$next_next_month;        if (!Schema::hasTable($sign_table)) {            Schema::create($sign_table, function (Blueprint $table) {                $table->increments('id');                $table->integer('uid');                $table->integer('price');                $table->date('day');                $table->integer('sign_time');                $table->dateTime('created_at');                $table->dateTime('updated_at');                $table->index('uid','ink_uid');                $table->index(['uid','sign_time'],'uid_sign_time');            });        }    }}
 |