diff --git a/database/migrations/0000_00_00_000000_create_washcar_coupons_table.php b/database/migrations/0000_00_00_000000_create_washcar_coupons_table.php new file mode 100644 index 0000000..0bff42b --- /dev/null +++ b/database/migrations/0000_00_00_000000_create_washcar_coupons_table.php @@ -0,0 +1,34 @@ +bigIncrements('id'); + $table->morphs('order'); + $table->string('code'); + $table->boolean('status')->default(1); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * @return void + */ + public function down() + { + Schema::dropIfExists('washcar_coupons'); + } + +} diff --git a/src/Models/Model.php b/src/Models/Model.php new file mode 100644 index 0000000..7640b5d --- /dev/null +++ b/src/Models/Model.php @@ -0,0 +1,21 @@ +version(), '7.0.0') < 0) { + return parent::serializeDate($date); + } + + return $date->format(Carbon::DEFAULT_TO_STRING_FORMAT); + } + +} diff --git a/src/Models/WashcarCoupon.php b/src/Models/WashcarCoupon.php new file mode 100644 index 0000000..47d90e5 --- /dev/null +++ b/src/Models/WashcarCoupon.php @@ -0,0 +1,25 @@ + 'json', + 'out_source' => 'json', + ]; + + const STATUS_INIT = 1; + const STATUS_SUCCESS = 2; + const STATUS_ERROR = 3; + + const STATUS = [ + self::STATUS_INIT => '初始', + self::STATUS_SUCCESS => '成功', + self::STATUS_ERROR => '失败', + ]; + +} diff --git a/src/Models/WashcarLog.php b/src/Models/WashcarLog.php index 554e64c..f1bc661 100644 --- a/src/Models/WashcarLog.php +++ b/src/Models/WashcarLog.php @@ -4,12 +4,10 @@ namespace XuanChen\WashCar\Models; use Carbon\Carbon; -class WashcarLog extends \Illuminate\Database\Eloquent\Model +class WashcarLog extends Model { - protected $guarded = []; - - protected $casts = [ + protected $casts = [ 'in_source' => 'json', 'out_source' => 'json', ]; @@ -24,13 +22,4 @@ class WashcarLog extends \Illuminate\Database\Eloquent\Model self::STATUS_ERROR => '失败', ]; - protected function serializeDate(\DateTimeInterface $date) - { - if (version_compare(app()->version(), '7.0.0') < 0) { - return parent::serializeDate($date); - } - - return $date->format(Carbon::DEFAULT_TO_STRING_FORMAT); - } - }