tutorials / shortcut-laravel-artisan

SHORTCUT LARAVEL ARTISAN COMMANDS

KEY FOR SHORTCUTS

Make

-m = migration
-c = controller
-r = resource (resource controller)
-f = factory
-s = seeder
-a = all (controller, model, migration, resource, factory, seeder)

Example:

  • create model, migration, controller, resource, factory, and seeder

    php artisan make:model Product -a
    
  • create model, migration, and controller

    php artisan make:model Product -m -c
    

    or

    php artisan make:model Product -mc
    
  • create model, migration, resource, and seeder

    php artisan make:model Product -m -r -s
    

    or

    php artisan make:model Product -mrs
    

Migrate

- fresh = drop all tables and re-run all migrations
- refresh = rollback all migrations and re-run all migrations
- reset = rollback all migrations
- rollback = rollback the last migration
- status = show the status of each migration

Example:

  • fresh migrate

    php artisan migrate:fresh
    
  • reset migrate

    php artisan migrate:reset
    

Seeder

- --seed = run all seeders
- --class = class (specific seeder)

Example:

  • run all seeders

    php artisan db:seed
    
    
  • run specific seeder

    php artisan db:seed --class=ProductSeeder
    

Route

-l = list all routes
-c = clear route cache
-r = route cache

Example:

  • list all routes

    php artisan route:list
    
  • clear route cache

      php artisan route:clear
    
  • route cache

    php artisan route:cache
    

Note:

For more shortcuts, will be updated soon.

SHortcut Laravel Artisan | tutorials | Study Notes | Ferdyhape