title: PHP Fatal error: Call to undefined method setContainer() during seeding in Laravel4
body: <p>I'm trying to seed a n:n relation between User and Role.
  The migrations are ok, but when I try to seed the db at the RoleUserTableSeeder the console give me this error:</p>
  
  <blockquote>
    <p>PHP Fatal error:  Call to undefined method CreateForeignKeys::setContainer() in /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Seeder.php on line 57<br>
    {"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Call to undefined method CreateForeignKeys::setContainer()","file":"/var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Seeder.php","line":57}}</p>
  </blockquote>
  
  <p>These are my migrations:</p>
  
  <p>2014_10_27_153245_create_users_table.php</p>
  
  <pre><code>&lt;?php
  
      use Illuminate\Database\Schema\Blueprint;
      use Illuminate\Database\Migrations\Migration;
  
      class CreateUsersTable extends Migration {
          public function up()
          {
              Schema::create('users', function($t) {
                  $t-&gt;string('name', 50);
                  $t-&gt;string('surname', 50);
                  $t-&gt;string('email', 100);
                  $t-&gt;string('username', 20);
                  $t-&gt;string('password', 60);
                  $t-&gt;string('remember_token', 100);
                  $t-&gt;timestamps();
                  $t-&gt;primary('username');
              });
          }
  
          public function down()
          {
              Schema::drop('users');
          }
      }
  ?&gt;
  </code></pre>
  
  <p>2014_10_29_162948_create_roles_table.php</p>
  
  <pre><code>&lt;?php
  
      use Illuminate\Database\Schema\Blueprint;
      use Illuminate\Database\Migrations\Migration;
  
      class CreateRolesTable extends Migration {
  
          public function up()
          {
              Schema::create('roles', function($t) {
                  $t-&gt;increments('id');
                  $t-&gt;string('role',50)-&gt;unique();
                  $t-&gt;timestamps();
              });
      }
  
      public function down()
      {
          Schema::drop('roles');
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>2014_10_29_163350_create_role_user_table.php</p>
  
  <pre><code>&lt;?php
  
      use Illuminate\Database\Schema\Blueprint;
      use Illuminate\Database\Migrations\Migration;
  
      class CreateRoleUserTable extends Migration {
  
          public function up()
          {
              Schema::create('role_user', function($t) {
                  $t-&gt;increments('id');
                  $t-&gt;integer('role_id')-&gt;unsigned();
                  $t-&gt;string('user_username');
              });
          }
  
          public function down()
          {
              Schema::drop('role_user');
          }
  
      }
  
      ?&gt;
  </code></pre>
  
  <p>2014_10_29_163723_create_foreign_keys.php</p>
  
  <pre><code>&lt;?php
  
  
      use Illuminate\Database\Schema\Blueprint;
      use Illuminate\Database\Migrations\Migration;
  
      class CreateForeignKeys extends Migration {
  
          public function up()
          {   
              Schema::table('role_user', function($t) {
                  $t-&gt;foreign('role_id')-&gt;references('id')-&gt;on('roles')
                      -&gt;onUpdate('cascade');
          });
          Schema::table('role_user', function($t) {
              $t-&gt;foreign('user_username')-&gt;references('username')-&gt;on('users')
                  -&gt;onUpdate('cascade');
          });
      }
  
      public function down()
      {
          Schema::table('role_user', function($t) {
              $t-&gt;dropForeign('role_user_role_id_foreign');
          });
          Schema::table('role_user', function($t) {
              $t-&gt;dropForeign('role_user_user_username_foreign');
          });
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>... and these are my seeder:</p>
  
  <p>UserTableSeeder.php</p>
  
  <pre><code>&lt;?php
  
      ## Seeder for the user table to create the admin user
      class UserTableSeeder extends Seeder 
      {
          public function run()
          {
              DB::table('users')-&gt;delete();
              DB::table('users')-&gt;insert(array(
                  'name'      =&gt; 'xxxx',
                  'surname'   =&gt; 'xxxx',
                  'email'     =&gt; 'xxxx@yyyy.com',
                  'password'  =&gt; Hash::make('admin'),
                  'username'  =&gt; 'admin',
              ));
          }
      }
  ?&gt;
  </code></pre>
  
  <p>RoleTableSeeder.php</p>
  
  <pre><code>&lt;?php
  
      ## Seeder for the role table to create the admin user
      class RoleTableSeeder extends Seeder 
      {
          public function run()
          {
              DB::table('roles')-&gt;delete();
              DB::table('roles')-&gt;insert(array(
                  'role'      =&gt; 'admin'
              ));
          }
      }
  
  ?&gt;
  </code></pre>
  
  <p>RoleUserTableSeeder.php</p>
  
  <pre><code>&lt;?php
  
      ## Seeder for the role_user table to create the admin user
      class RoleUserTableSeeder extends Seeder 
      {
          public function run()
          {
              DB::table('role_user')-&gt;delete();
              DB::table('role_user')-&gt;insert(array(
                  'user_username' =&gt; 'admin',
                  'role_id' =&gt; Role::getId('admin')
              ));
          }
      }
  
  ?&gt;
  </code></pre>
  
  <p>and this is my getId function in the Role model:</p>
  
  <p>Role.php</p>
  
  <pre><code>...
  ## Return the id of a role
  public static function getId($mansion) {
      return Role::where('role','=',$mansion)-&gt;pluck('id');
  }
  ...
  </code></pre>
  
  <p>Someone can help me fixing this error?
  Thanks!</p>