From 45aba84111f163eba45783de19e30d0940a4d59d Mon Sep 17 00:00:00 2001 From: xiaomlove <353856593@qq.com> Date: Fri, 18 Jun 2021 21:51:19 +0800 Subject: [PATCH] HitAndRun --- app/Models/HitAndRun.php | 31 ++++++++++++++++ ...06_18_125347_create_hit_and_runs_table.php | 37 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 app/Models/HitAndRun.php create mode 100644 database/migrations/2021_06_18_125347_create_hit_and_runs_table.php diff --git a/app/Models/HitAndRun.php b/app/Models/HitAndRun.php new file mode 100644 index 00000000..df98e3ba --- /dev/null +++ b/app/Models/HitAndRun.php @@ -0,0 +1,31 @@ + ['text' => '考察中'], + self::STATUS_PASSED => ['text' => '已通过'], + self::STATUS_NOT_PASSED => ['text' => '未通过'], + self::STATUS_CANCELED => ['text' => '已取消'], + ]; + + public function getStatusTextAttribute() + { + return self::$status[$this->status] ?? ''; + } + + +} diff --git a/database/migrations/2021_06_18_125347_create_hit_and_runs_table.php b/database/migrations/2021_06_18_125347_create_hit_and_runs_table.php new file mode 100644 index 00000000..55c7a5e2 --- /dev/null +++ b/database/migrations/2021_06_18_125347_create_hit_and_runs_table.php @@ -0,0 +1,37 @@ +id(); + $table->integer('uid')->index(); + $table->integer('peer_id')->unique(); + $table->integer('torrent_id')->index(); + $table->integer('status')->default(1); + $table->string('comment')->default(''); + $table->timestamp('created_at')->useCurrent(); + $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('hit_and_runs'); + } +}