|
|
@@ -1,36 +0,0 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-use App\Events\SendEmailEvent;
|
|
|
-use App\MailEvent;
|
|
|
-use App\Role;
|
|
|
-use Illuminate\Database\Migrations\Migration;
|
|
|
-use Illuminate\Database\Schema\Blueprint;
|
|
|
-use Illuminate\Support\Facades\DB;
|
|
|
-use Illuminate\Support\Facades\Schema;
|
|
|
-
|
|
|
-class AddDefaultMailEventRole extends Migration
|
|
|
-{
|
|
|
- protected $role;
|
|
|
- /**
|
|
|
- * Run the migrations.
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function up()
|
|
|
- {
|
|
|
- $this->role = Role::query()->firstOrCreate(['name'=>'发送邮件测试']);
|
|
|
- $emailEvent = MailEvent::query()->where('name', '发送默认邮件')->first();
|
|
|
- $emailEvent->roles()->attach($this->role->id);
|
|
|
- $this->role->users()->attach(\App\User::query()->where('name','yang')->first()->id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Reverse the migrations.
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function down()
|
|
|
- {
|
|
|
- $this->role->delete();
|
|
|
- }
|
|
|
-}
|