L'intégrité de la violation de la contrainte: 1452 laravel

J'ai deux tables dans laravel créé à la suite de migrations:

La migration des utilisateurs:

public function up()
{
    Schema::create('users', function($table){
        $table->increments('id')->unsigned();
        $table->string('email')->unique();
        $table->string('password', 64);
        $table->string('first_name', 32);
        $table->string('last_name', 32);
        $table->string('remember_token', 100)->nullable();
    });
}

Occasion de la migration:

public function up()
{
Schema::create('occasions', function($table){
$table->increments('id')->unsigned();
$table->integer('created_by_user_id')->unsigned();
$table->foreign('created_by_user_id')->references('id')->on('users');
$table->integer('updated_by_user_id')->unsigned();
$table->foreign('updated_by_user_id')->references('id')->on('users');
$table->timestamps();
$table->string('title')->unique();
$table->string('slug')->unique();
$table->integer('category')->unsigned();
$table->foreign('category')->references('id')->on('occasion_categories');
$table->string('brand', 32);
$table->string('model', 32)->nullable();
$table->string('type', 32)->nullable();
$table->string('body', 32)->nullable();
$table->string('color', 32);
$table->integer('fuel')->unsigned()->nullable();
$table->foreign('fuel')->references('id')->on('occasion_fuels');
$table->integer('transmission')->unsigned()->nullable();
$table->foreign('transmission')->references('id')->on('occasion_transmissions');
$table->decimal('usage', 6, 2)->nullable();
$table->integer('engine_capacity')->unsigned()->nullable();
$table->integer('building_year')->unsigned()->nullable();
$table->string('sign', 8)->nullable();
$table->date('mot')->nullable();
$table->integer('kilometers')->nullable();
$table->decimal('price', 8, 2);
$table->decimal('action_price', 8, 2)->nullable();
$table->text('description')->nullable();
});
}

Maintenant, quand j'essaie de créer une Occasion avec le code suivant:

Occasion::create(array(
'created_by_user_id'=>Auth::id(),
'updated_by_user_id'=>Auth::id(),
'title'=>Input::get('title'),
'slug'=>Str::slug(Input::get('title')),
'category'=>Input::get('category'),
'brand'=>Input::get('brand'),
'model'=>Input::get('model'),
'type'=>Input::get('type'),
'body'=>Input::get('body'),
'color'=>Input::get('color'),
'fuel'=>Input::get('fuel'),
'transmission'=>Input::get('transmission'),
'usage'=>Input::get('usage'),
'engine_capacity'=>Input::get('engine-capacity'),
'building_year'=>Input::get('building-year'),
'sign'=>Input::get('sign'),
'mot'=>Input::get('mot'),
'kilometers'=>Input::get('kilometers'),
'price'=>Input::get('price'),
'action_price'=>Input::get('action-price'),
'description'=>Input::get('description')
));

J'obtiens l'erreur suivante:

SQLSTATE[23000]: Integrity constraint violation: 1452 Ne peut pas ajouter ou mettre à jour un enfant row: a foreign key constraint fails (henw.occasions, CONTRAINTE occasions_created_by_user_id_foreign CLÉ ÉTRANGÈRE (created_by_user_id) RÉFÉRENCES users (id)) (SQL: insert into occasions (updated_at, created_at) valeurs (2014-06-30 18:42:11, 2014-06-30 18:42:11))

J'ai cherché sur Google mais la plupart des gens disent que je reçois ce message d'erreur parce que la clé étrangère n'existe pas, mais ce n'est pas vrai, parce que quand j'essaie d'ajouter les mêmes valeurs dans PhpMyAdmin fonctionne et l'id de l'utilisateur qui je suis insertion est 1 et il n'existe pas.

OriginalL'auteur user3527894 | 2014-06-30