Q:

errno: 150 "Foreign key constraint is incorrectly formed" in laravel 5.5

I have users table where i am storing all students and teachers details.
teachers can create students, these reference is stored in users_references table.
users table 
Schema::create('users', function (Blueprint $table) 
{
     $table->increments('id')->unsigned();
     $table->string('name');
     $table->string('uniqueid')->unique();
     $table->integer('contactnumber');
     $table->string('password');
}

users_references table
    Schema::create('users_references', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('userid');
        $table->integer('teacherid');
        $table->enum('status',['A','I']);
        $table->timestamps();

        $table->foreign('userid')
              ->references('id')
              ->on('users')
              ->onDelete('cascade');

        $table->foreign('teacherid')
              ->references('id')
              ->on('users')
              ->onDelete('cascade');
    });

while migrating i am getting an error 

A:

Try adding unsigned() in the users_references table for  id. 
Laravel's increments('id') function creates an unsigned integer, so the foreign key column also needs to be unsigned.

