WechatOrderChargeDateStatistic.php 977 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Modules\Trade\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Support\Facades\Schema;
  6. class WechatOrderChargeDateStatistic extends Model
  7. {
  8. protected $table = 'wechat_order_charge_date_statistic';
  9. protected $fillable = [
  10. 'date',
  11. 'platform',
  12. 'app_id',
  13. 'amount',
  14. ];
  15. public static function createTable()
  16. {
  17. if (!Schema::hasTable('wechat_order_charge_date_statistic')) {
  18. Schema::create('wechat_order_charge_date_statistic', function (Blueprint $table) {
  19. $table->increments('id');
  20. $table->string('date', 10);
  21. $table->string('platform', 50);
  22. $table->string('app_id', 64);
  23. $table->float('amount');
  24. $table->timestamps();
  25. $table->unique(['app_id', 'date', 'platform'], 'idx_month_appid');
  26. });
  27. }
  28. }
  29. }