Friday, November 13, 2020

Laravel quick commands for Artisan

 Laravel utilise Artisan to help make working with development faster. This allow programmers to focus more on the development than the management of packages and some repeated workflows.

Here I list the top few commands that I use;

For scaffolding

  • make:controller
    • Create a controller file in app/Http/Controllers
    • php artisan make:controller ArticleController
  • Create a default model
    • php artisan make:model Article
  • Create a model along with migration and factory
    • php artisan make:model Article -crmf
  • Create migration file
    • php artisan make:migration create_articles_table
  • Process all the migration file that haven't been run before
    • php artisan migrate
  • Create Seeder file
    • php artisan make:seeder CustomerTableSeeder
  • Process seeder file
    • php artisan db:seed
    • php artisan db:seed --class=CustomerTableSeeder
  • List command help
    • php artisan list
  • Routing
    • php artisan route:list
  • Debugging
    • php artisan tinker
  • Front-end user interface
    • php artisan ui bootstrap|vue|react
  • Remove Front-end user interface
    • php artisan preset none
  • Create front-end with user authentication
    • php artisan ui vue --auth
  • A stand alone server start, maintenance mode, normal mode
    • php artisan serve
    • php artisan down
    • php artisan up
  • Refresh laravel optimisation files
    • php artisan dump-autoload

No comments:

Blog Archive