/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Permission::create(['name' => 'Can Create Users', 'slug' => 'can-create-users', 'description' => 'Can Create Users']);
     Permission::create(['name' => 'Can Delete Users', 'slug' => 'can-delete-users', 'description' => 'Can Delete Users']);
     Permission::create(['name' => 'Can Moderate Forum', 'slug' => 'can-moderate-forum', 'description' => 'Can Moderate Forum']);
     Permission::create(['name' => 'Can Access Statistics', 'slug' => 'can-access-statistics', 'description' => 'Can Access Statistics']);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $roleIds = Role::lists('id')->toArray();
     $permissionIds = Permission::lists('id')->toArray();
     foreach ($roleIds as $roleId) {
         $permissions = $faker->randomElements($permissionIds, $faker->numberBetween(1, count($permissionIds)));
         // Skip rest of the loop if $categories empty
         if (empty($permissions)) {
             continue;
         }
         foreach ($permissions as $permissionId) {
             DB::table('users_pivot_permission_role')->insert(['role_id' => $roleId, 'permission_id' => $permissionId]);
         }
     }
 }