Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 563db90d6b |
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateWashcarCouponsTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('washcar_coupons', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
21
src/Models/Model.php
Normal file
21
src/Models/Model.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\WashCar\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class Model extends \Illuminate\Database\Eloquent\Model
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
25
src/Models/WashcarCoupon.php
Normal file
25
src/Models/WashcarCoupon.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace XuanChen\WashCar\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class WashcarCoupon extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'in_source' => '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 => '失败',
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,11 +4,9 @@ namespace XuanChen\WashCar\Models;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class WashcarLog extends \Illuminate\Database\Eloquent\Model
|
class WashcarLog extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $guarded = [];
|
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'in_source' => 'json',
|
'in_source' => 'json',
|
||||||
'out_source' => 'json',
|
'out_source' => 'json',
|
||||||
@@ -24,13 +22,4 @@ class WashcarLog extends \Illuminate\Database\Eloquent\Model
|
|||||||
self::STATUS_ERROR => '失败',
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user