//exemple :
//php artisan make:migration add_new_column_to_my_table_table --table=my_table
//php artisan make:migration add_login_to_users_table --table=users
public function up()
{
Schema::table('my_table', function($table) {
$table->integer('new_column')->after('other_column_name');
//with after it's better to place it in your table
});
}
public function down()
{
Schema::table('my_table', function($table) {
$table->dropColumn('new_column');
});
}
**STEP 1**
php artisan make:migration add_sex_to_users_table --table=users
**STEP 2**
In the new generated migration file, you will find up and down hook methods. in up hook, add there columns that you want to add, and in down hook, add there columns that you need to remove. for example, Me i need to add sex on column of users, so I will add there following line in the up hook.
$table->integer('quantity')->default(1)->nullable();
So i have something like this
public function up()
{
Schema::table('service_subscriptions', function (Blueprint $table) {
$table->integer('quantity')->default(1)->nullable();
});
}
**STEP 3**
Run the migration command as follows
php artisan migrate
Then you will have a new collumn added!!!!
THANK ME LATER!
// The table method on the Schema facade MAY BE USED TO UPDATE EXISTING TABLES.
// The table method accepts two arguments: the name of the table and a Closure
// that receives a Blueprint instance you may use to add columns to the table:
Schema::table('users', function (Blueprint $table) {
$table->string('email');
});