Skip to content

Instantly share code, notes, and snippets.

@robinmitra
Created April 13, 2014 10:33
Show Gist options
  • Save robinmitra/10578271 to your computer and use it in GitHub Desktop.
Save robinmitra/10578271 to your computer and use it in GitHub Desktop.
Cheatsheet for Jeffrey Way's Laravel Generators
## Migration
# Create a migration to create a table named 'posts'
php artisan generate:migration create_posts_table
# Create a migration to add a field named 'user_id' to the 'posts' table
php artisan generate:migration add_user_id_to_posts_table
# Create a migration to remove the 'user_id' field we just created
php artisan generate:reomve_user_id_from_posts_table
# Create a migration to delete the 'posts' table we just created
php artisan generate:migration delete_posts_table
# Create a migration to create a table named 'posts' and also generate the schema for a number of fields
php artisan generate:migration create_posts_table --fields="title:string, body:text, age:integer:nullable:default(18), username:string(30):unique"
# Create a migration to remove the 'age' field we just created
php artisan generate:reomve_age_from_posts_table --fields="age"
@ajdeguzman
Copy link

wow, thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment