Remember this artisan command when you create a new table

Hey guys,
This command has been presented there for a while but I want to share it again 🥹
Before I usually do:
php artisan make:migration CreateAbcTablesphp artisan make:model Abcphp artisan make:factory Abc...
It's quite a hassle, isn't it? But actually, there is a way to do it in 1 go 😎
The combination
php artisan make:model Article --migration --factory
Once hitting this one, it will create for us:
Article model
Migration (with
Schema::create('articles', ...)), automatically do the "pluralize".Article Factory (optional - if you want to write tests)
Additional params
--controller--resource--policy--seed--all: this will create everything 😆
IMO, I do think that model, migration & factory are good enough for the first go. We can create a controller or policy or else in later 🤗.
Additional tips
When creating a migration to change the schema of an existing table, try put the name like this:
AddUserIdColumnToUsersTable
ChangeAmountTypeInTransactionsTable
DeleteUserIdFromEventsTable
Laravel will extract the middle part, transform the table into the snack_case, and prepare the base code for us
Schema::table('{your_table}', ...);
Save a bit of your time, eh? 🥹
Ending words
Thank you for reading this, I believe many of us already know & aware of these options. Save time and jump into productivity quicker.
Laravel is so beautiful 😍



