PHP Artisan Migre Create Table
php artisan make:migration create_users_table
php artisan migrate
Shadow
php artisan make:migration create_users_table
php artisan migrate
php artisan make:model Model_Name -m
Schema::table('posts', function (Blueprint $table) {
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
$table->foreignId('user_id')->constrained();
});
php artisan make:migration create_users_table
# If you would like to generate a database migration when you
# generate the model, you may use the --migration or -m option:
php artisan make:model Flight --migration
php artisan make:model Flight -m
Try this command it works for me
php artisan migrate:fresh
However, be careful! This command will drop all data from your DB: