I am trying to add a foreign key to the 'users' table. These are the time stamps of the migration
And this is the code:
Schema::create('types', function (Blueprint $table) {
$table->increments('id');
$table->string('types');
$table->timestamps();
});
Schema::create('users', function (Blueprint $table) {
//...
$table->integer('type')->length(10)->unsigned();
$table->foreign('type')->references('id')->on('types')->onDelete('cascade');
$table->rememberToken();
$table->timestamps();
});
I really don't know what I do wrong.
EDIT Here is what happens after the suggestions which I received
via Ileana Profeanu