laravel edit table migration code example

Example 1: add column in laravel migration

php artisan make:migration add_paid_to_users_table --table=users

Example 2: how to change existing migration laravel

php artisan make:migration update_user_guide_in_product_translations_table

Example 3: rename table migration laravel

Schema::rename($from, $to);

Example 4: laravel drop foreign column

// Searched, laravel drop foreign column
Schema::table('users', function (Blueprint $table) {
    $table->dropColumn(['votes', 'avatar', 'location']);
});

Example 5: change existing migration laravel

php artisan make:migration update_description_in_products_table

Tags:

Php Example