Posts Learn Components Snippets Categories Tags About
/

Laravel Artisan Command Help

Learn how to get the available commands in Laravel

Created on Aug 02, 2021

8 views

Many of the artisan command in Laravel requires options and some even require a parameter. Since there are many commands it's easy to forget what's the right option or parameter to pass.

To check the options of an artisan command you can run the command with "--help" flag.
php artisan --help make:model

By passing the "--help" flag, each of the command options will be returned to the console and you will be able to view all of them. In the case of the "make:model" command, below are the help and you can refer to 
Description:
  Create a new Eloquent model class

Usage:
  make:model [options] [--] <name>

Arguments:
  name                  The name of the class

Options:
  -a, --all             Generate a migration, seeder, factory, and resource controller for the model
  -c, --controller      Create a new controller for the model
  -f, --factory         Create a new factory for the model
      --force           Create the class even if the model already exists
  -m, --migration       Create a new migration file for the model
  -s, --seed            Create a new seeder file for the model
  -p, --pivot           Indicates if the generated model should be a custom intermediate table model
  -r, --resource        Indicates if the generated controller should be a resource controller
      --api             Indicates if the generated controller should be an API controller
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Do note that you can use "--help" for the other commands as well.
php artisan --help make:migration
php artiasn --help make:controller
php artisan --help make:seeder

Snippets by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.

Load comments for Laravel Artisan Command Help

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your project.

View Components

Other Code Snippets

More