In my migration file , I am adding organization id to the user's table , i tried all of the code below but not solved yet
class AddOrganizationIdToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
// $table->foreignId('organization_id')->references('id')->on('organizations')->onDelete('cascade');
$table->foreignId('organization_id')->constrained('organizations')->cascadeOnDelete();
// $table->foreign('organization_id')->references('id')->on('organizations')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
//
});
}