ajun 4 лет назад
Родитель
Сommit
20a1a495c3

+ 4 - 4
app/TerminalPrinter.php

@@ -7,13 +7,14 @@ use Illuminate\Database\Eloquent\Model;
 
 use App\Traits\ModelLogChanging;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
 
 class TerminalPrinter extends Model
 {
     use ModelLogChanging;
     use ModelTimeFormat;
 
-    protected $fillable = ['terminal_id', 'printer_name', 'alias_name', 'logistic_id'];
+    protected $fillable = ['terminal_id', 'printer_name', 'alias_name'];
 
 
     public function terminal(): BelongsTo
@@ -21,9 +22,8 @@ class TerminalPrinter extends Model
         return $this->belongsTo(Terminal::class);
     }
 
-
-    public function logistic_id(): BelongsTo
+    public function logistics(): BelongsToMany
     {
-        return $this->belongsTo(Logistic::class);
+        return $this->belongsToMany(Logistic::class,TerminalPrinterLogistic::class);
     }
 }

+ 0 - 2
database/migrations/2021_06_18_150129_create_terminal_printers_table.php

@@ -26,7 +26,6 @@ class CreateTerminalPrintersTable extends Migration
             $table->string('terminal_id')->comment('终端id');
             $table->string('printer_name')->comment('打印机名称');
             $table->string('alias_name')->comment('打印机别名');
-            $table->tinyInteger('print_type')->comment('打印类型');
             $table->timestamps();
         });
     }
@@ -39,6 +38,5 @@ class CreateTerminalPrintersTable extends Migration
     public function down()
     {
         Schema::dropIfExists('terminal_printers');
-
     }
 }

+ 0 - 41
database/migrations/2021_07_28_104043_change_terminal_printers_delivery_interface.php

@@ -1,41 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class ChangeTerminalPrintersDeliveryInterface extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::table('owner_logistic_print_templates',function(Blueprint $table){
-            $table->dropColumn("delivery_interface");
-        });
-        Schema::table('terminal_printers',function(Blueprint $table){
-            $table->tinyInteger('logistic_id')->comment('快递');
-            $table->dropColumn('print_type');
-        });
-
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::table('owner_logistic_print_templates',function(Blueprint $table){
-            $table->integer('delivery_interface')->comment('下发接口');
-        });
-        Schema::table('terminal_printers',function(Blueprint $table){
-            $table->tinyInteger('print_type')->comment('打印类型');
-            $table->dropColumn("logistic_id");
-        });
-    }
-}