laravel errno 150 contrainte de clé étrangère est mal formée

Quelqu'un peut-il m'aider à résoudre ce problème?

Il y a 3 tables avec 2 clés étrangères:

         Schema::create('users', function (Blueprint $table) {
                    $table->increments('id');
                    $table->string('name');
                    $table->string('email')->unique();
                    $table->string('password');
                    $table->rememberToken();
                    $table->timestamps();
                });

        Schema::create('firms', function (Blueprint $table) {
                    $table->increments('id');
                    $table->string('title')->nullable();  
                    $table->integer('user_id')->unsigned()->nullable();
                    $table->foreign('user_id')->references('id')->on('users');
                    $table->timestamps();
                });
       Schema::create('jobs', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title')->nullable();
            $table->integer('firm_id')->unsigned()->nullable();
            $table->foreign('firm_id')->references('id')->on('firms');
            $table->timestamps();
        });

D'erreur après l'exécution de la migration:

[Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1005 Can't create table `job`.`#sql-5fc_a1`
   (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter ta
  ble `firms` add constraint `firms_user_id_foreign` foreign key (`user_id`)
  references `users` (`id`))

  [PDOException]
  SQLSTATE[HY000]: General error: 1005 Can't create table `job`.`#sql-5fc_a1`
   (errno: 150 "Foreign key constraint is incorrectly formed")
Désolé, ça ne fonctionne pas: Schema::create('entreprises', function (Plan $tableau) { $table->incrémente('id')->unsigned(); Schéma::create('emplois', function (Plan $tableau) { $table->incrémente('id'); $table->entier('firm_id')->unsigned(); $table->étrangères('firm_id')->références('id')-> ('entreprises');
et ce n'est pas trop d': Schema::create('entreprises', function (Plan $tableau) { $table->incrémente('id'); Schéma::create('emplois', function (Plan $tableau) { $table->incrémente('id'); $table->entier('firm_id'); $table->étrangers('firm_id')->références('id')-> ('entreprises');

OriginalL'auteur Yrtymd | 2016-11-29