laravel 8 foreign key
Schema::table('posts', function (Blueprint $table) {
$table->foreignId('user_id')->constrained();
});
laravel 8 foreign key
Schema::table('posts', function (Blueprint $table) {
$table->foreignId('user_id')->constrained();
});
laravel view not created using foreign keys
Schema::create('larachat_chat_rooms', function (Blueprint $table) {
$table->increments('id');
//Foreign key must be unsignedBigInteger
$table->unsignedBigInteger('creator_id');
$table->softDeletes();
$table->timestamps();
//Define foreign key id here
$table->foreign('creator_id')->references('id')->on('users')->onDelete('cascade');
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us