Add a new column to table:

For example, lets add a new column called   shipping_price to the 'orders' table, use this command:

$ php artisan make:migration add_shipping_column_to_orders_table

A new filed called 202x_xx_1xx_00xxx_add_shipping_column_to_orders_table.php will be created

To add a new shipping_price edit the file with the following up and down methods example:

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('orders', function (Blueprint $table) {
            $table->decimal('shipping_price', 20, 2);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('orders', function (Blueprint $table) {
            $table->dropColumn('shipping_price');
        });
    }
};


 

Run the migrations command to add the column in the database:

$ php artisan migrate

Now the new column will be added:

Additional Notes form the useful video below:

2jQ2M5vD5sM

php artisan make:migration create_blogs_table --create=blogs
xxx_create_blogs_table.php
schema::create('blogs')

php artisan make:migration add_author_to_blogs_table
xxxx add_author_to_blogs_table.php

php artisan migration:rollback