title: Faker and Laravel 5
body: <p>I'm trying to figure out if someone knows a way to perform this task. I am wanting to try and tell how many of each type of role to have for the users inserted. That way I can have it say I only want 1 other of role number 4 and 2 of role number 3 and have the rest be one. I'm sure there's going to be some additional logic but not sure how something like this should be written.</p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Database\Seeder;
  
  // Composer: "fzaninotto/faker": "v1.3.0"
  use Faker\Factory as Faker;
  
  use App\User;
  
  class UsersTableSeeder extends Seeder {
  
      public function run()
      {
          // use the factory to create a Faker\Generator instance
          $faker = Faker::create();
  
          $roleIds = App\Role::lists('id');
  
          User::create([
              'first_name' =&gt; 'Me',
              'last_name' =&gt; 'Me',
              'username' =&gt; 'me',
              'email' =&gt; 'me@gmail.com',
              'password' =&gt; 'secret',
              'active' =&gt; 1,
              'role_id' =&gt; 1
          ]);
  
          foreach(range(2, 100) as $index) {
  
              User::create([
                  'first_name' =&gt; $faker-&gt;firstName,
                  'last_name' =&gt; $faker-&gt;lastName,
                  'username' =&gt; str_replace('.', '_', $faker-&gt;unique()-&gt;userName),
                  'email' =&gt; $faker-&gt;email,
                  'password' =&gt; $faker-&gt;word,
                  'active' =&gt; $faker-&gt;boolean($chanceOfGettingTrue = 90),
                  'role_id' =&gt; $faker-&gt;randomElement($roleIds)
              ]);
          }
  
      }
  
  }
  </code></pre>