laravel drop column
snippet in php

laravel foreign key

user7889

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();
});

laravel migration remove column

user4932

public function up()
{
  Schema::table('table', function($table) {
    $table->dropColumn('column_name');
  });
}

add column in laravel migration

user5324

php artisan make:migration add_paid_to_users_table --table=users

laravel migration add unique column

user1762

Schema::table('tableName', function($table)
{
    $table->string('column-name')->unique(); //notice the parenthesis I added
});

laravel create db table

user8206

php artisan make:migration create_users_table

laravel drop column

user2238

// To drop a column, use the dropColumn method on the schema builder.
// Before dropping columns from a SQLite database, you will need to add
// the doctrine/dbal dependency to your composer.json file and run the
// composer update command in your terminal to install the library:

Schema::table('users', function (Blueprint $table) {
    $table->dropColumn('votes');
});