1$table->dropForeign('answers_user_id_foreign');
2$table->foreign('user_id')
3->references('id')->on('users')
4->onDelete('cascade');
5
1Schema::create('posts', function (Blueprint $table) {
2 $table->increments('id');
3 $table->integer('author')->unsigned();
4 $table->timestamps();
5 $table->foreign('author')->references('id')->on('users')->onUpdate('cascade');
6});
7
1Schema::create('posts', function (Blueprint $table) {
2 $table->id();
3 $table->foreignId('author')->constrained('users')->onDelete('cascade')->onUpdate('cascade');
4 $table->timestamps();
5});
6