| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- use App\Authority;
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class AddAuthOfStation extends Migration
- {
- protected $authNames=[
- "站管理",
- "站管理-监视器",
- ];
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- 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()
- {
- foreach ($this->authNames as $name){
- Authority::where('name',$name)->delete();
- }
- }
- }
|