| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- use App\Authority;
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class ChangeWaybillsTable extends Migration
- {
- protected $authNames=[
- "运输管理-发运"
- ];
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::table('waybills',function (Blueprint $table){
- $table->string('mileage')->nullable()->comment('里程');
- $table->bigInteger('amount')->nullable()->comment('件数');
- $table->string('inquire_tel')->nullable()->comment('查件电话');
- });
- foreach ($this->authNames as $name){
- if(!Authority::where('name',$name)->first())(new Authority(['name'=>$name,'alias_name'=>$name]))->save();
- }
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('waybills',function (Blueprint $table){
- $table->dropColumn('mileage');
- $table->dropColumn('amount');
- $table->dropColumn('inquire_tel');
- });
- foreach ($this->authNames as $name){
- Authority::where('name',$name)->delete();
- }
- }
- }
|