2019_12_30_114648_add_weigh_authority.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use App\Authority;
  3. use Illuminate\Support\Facades\Schema;
  4. use Illuminate\Database\Schema\Blueprint;
  5. use Illuminate\Database\Migrations\Migration;
  6. class AddWeighAuthority extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. (new Authority(['name'=>'纸箱','alias_name'=>'纸箱']))->save();
  16. (new Authority(['name'=>'纸箱-查询','alias_name'=>'纸箱-查询']))->save();
  17. (new Authority(['name'=>'纸箱-录入','alias_name'=>'纸箱-录入']))->save();
  18. (new Authority(['name'=>'纸箱-编辑','alias_name'=>'纸箱-编辑']))->save();
  19. (new Authority(['name'=>'纸箱-删除','alias_name'=>'纸箱-删除']))->save();
  20. (new Authority(['name'=>'测量设备','alias_name'=>'测量设备']))->save();
  21. (new Authority(['name'=>'测量设备-查询','alias_name'=>'测量设备-查询']))->save();
  22. (new Authority(['name'=>'测量设备-录入','alias_name'=>'测量设备-录入']))->save();
  23. (new Authority(['name'=>'测量设备-编辑','alias_name'=>'测量设备-编辑']))->save();
  24. (new Authority(['name'=>'测量设备-删除','alias_name'=>'测量设备-删除']))->save();
  25. }
  26. /**
  27. * Reverse the migrations.
  28. *
  29. * @return void
  30. */
  31. public function down()
  32. {
  33. Authority::where('name','纸箱')->delete();
  34. Authority::where('name','纸箱-查询')->delete();
  35. Authority::where('name','纸箱-录入')->delete();
  36. Authority::where('name','纸箱-编辑')->delete();
  37. Authority::where('name','纸箱-删除')->delete();
  38. Authority::where('name','测量设备')->delete();
  39. Authority::where('name','测量设备-查询')->delete();
  40. Authority::where('name','测量设备-录入')->delete();
  41. Authority::where('name','测量设备-编辑')->delete();
  42. Authority::where('name','测量设备-删除')->delete();
  43. }
  44. }