vendredi 23 août 2019

strange thing about foreign key in laravel

I meet Strange Problem when i use foreignkey in laravel

When i used unsignedBigInteger Foreign key work

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});

But if i just edit Datatype it to

$table->*unsignedInteger('user_id');

** or

$table->Integer('user_id');

Foreign key Not work

i don't know why this happend



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire