Commit 13b1b812 by lujunyi

修改表名

parent 6985b8b4
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
namespace App\Admin\Repositories; namespace App\Admin\Repositories;
use App\Models\DrugTagInquiryModel as Model; use App\Models\DrugTagRelatedInquiryModel as Model;
use Dcat\Admin\Repositories\EloquentRepository; use Dcat\Admin\Repositories\EloquentRepository;
class DrugTagInquiryRepository extends EloquentRepository class DrugTagRelatedInquiryRepository extends EloquentRepository
{ {
/** /**
* Model. * Model.
......
...@@ -10,4 +10,9 @@ class DrugRelatedTagModel extends Model ...@@ -10,4 +10,9 @@ class DrugRelatedTagModel extends Model
use HasDateTimeFormatter; use HasDateTimeFormatter;
protected $table = 'drug_related_tag'; protected $table = 'drug_related_tag';
protected $fillable = [
'drug_id',
'tag_id',
];
} }
...@@ -18,7 +18,7 @@ public function inquiry() ...@@ -18,7 +18,7 @@ public function inquiry()
{ {
$relatedModel = InquiryModel::class; // 药品标签要关联的问诊问题模型类名 $relatedModel = InquiryModel::class; // 药品标签要关联的问诊问题模型类名
$pivotTable = 'drug_tag_inquiry'; // 药品标签和问诊问题关联中间表 $pivotTable = 'drug_tag_related_inquiry'; // 药品标签和问诊问题关联中间表
return $this->belongsToMany($relatedModel, $pivotTable, 'tag_id', 'inquiry_id')->withTimestamps(); return $this->belongsToMany($relatedModel, $pivotTable, 'tag_id', 'inquiry_id')->withTimestamps();
} }
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
use Dcat\Admin\Traits\HasDateTimeFormatter; use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class DrugTagInquiryModel extends Model class DrugTagRelatedInquiryModel extends Model
{ {
use HasDateTimeFormatter; use HasDateTimeFormatter;
protected $table = 'drug_tag_inquiry'; protected $table = 'drug_tag_related_inquiry';
protected $fillable = [ protected $fillable = [
'tag_id', 'tag_id',
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
*/ */
public function up(): void public function up(): void
{ {
Schema::create('drug_tag_inquiry', function (Blueprint $table) { Schema::create('drug_tag_related_inquiry', function (Blueprint $table) {
$table->comment('药品标签和问诊问题关联表'); $table->comment('药品标签和问诊问题关联表');
$table->bigIncrements('id'); $table->bigIncrements('id');
$table->bigInteger('tag_id')->comment('药品标签ID'); $table->bigInteger('tag_id')->comment('药品标签ID');
...@@ -25,6 +25,6 @@ public function up(): void ...@@ -25,6 +25,6 @@ public function up(): void
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('drug_tag_inquiry'); Schema::dropIfExists('drug_tag_related_inquiry');
} }
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment