If you make a migration for existing table, and you want Laravel to generate the Schema::table() for you, then add "_in_xxxxx_table" or "_to_xxxxx_table" at the end, or specify "--table" parameter.
php artisan change_fields_products_table generates empty class
class ChangeFieldsProductsTable extends Migration{ public function up() { // }}
But add in_xxxxx_table php artisan make:migration change_fields_in_products_table and it generates class with Schema::table() pre-filled
class ChangeFieldsProductsTable extends Migration{ public function up() { Schema::table('products', function (Blueprint $table) { // }) };}
Also you can specify --table parameter php artisan make:migration whatever_you_want --table=products
class WhateverYouWant extends Migration{ public function up() { Schema::table('products', function (Blueprint $table) { // }) };}
Enjoyed This Tip?
Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.
Recent Courses on Laravel Daily
[NEW] Practical Laravel Security: Packages, Secrets, Supply-Chain Attacks
7 lessons
43 min read
Laravel 13 Starter Kit Teams and Customizations
10 lessons
33 min
How to Structure Laravel 13 Projects
16 lessons
1 h 32 min read