/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('backend_users_groups', function (Blueprint $table) {
         $table->unsignedInteger('user_id');
         $table->unsignedInteger('group_id');
         $table->primary(['user_id', 'group_id']);
         $table->foreign('user_id')->references('id')->on('backend_users')->onDelete('cascade');
         $table->foreign('group_id')->references('id')->on('backend_groups')->onDelete('cascade');
     });
     //Add initial user.
     $group = Group::create(['caption' => 'Administrators', 'permissions' => Backend::getAllAcl()]);
     $user = User::create(['email' => '*****@*****.**', 'password' => 'admin', 'active' => 1]);
     $user->groups()->attach($group);
 }
예제 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     User::create(['email' => '*****@*****.**', 'password' => 'admin', 'active' => 1]);
 }