Ayuda general de Laravel-crear un controlador

 

Ayuda general de Laravel

bash
php artisan help

Esto muestra una lista de todos los comandos disponibles, organizados por categorías.


2. Ayuda para un comando específico

bash
php artisan help make:controller

O también puedes usar:

bash
php artisan make:controller --help

Esto te mostrará:

text
Description:
  Create a new controller class

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

Arguments:
  name                  The name of the controller class

Options:
  -e, --env[=ENV]      The environment the command should run under
  -f, --force          Create the class even if the controller already exists
      --resource       Generate a resource controller class
      --api            Generate an API resource controller class
      --invokable      Generate a single action controller
      --requests       Generate form request classes (only with --resource)
      --parent[=PARENT] Parent model name (only with --resource)
      --model[=MODEL]  Model name (only with --resource)
      --test[=TEST]    The test class name
      --pest[=PEST]    The test class name (Pest)
  -h, --help            Display help for the given 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

3. Ver opciones de un comando sin ejecutarlo

bash
php artisan make:controller -h

Es lo mismo que --help pero más corto.


4. Ayuda para migraciones

bash
php artisan help make:migration

Muestra:

text
Description:
  Create a new migration file

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

Arguments:
  name                  The name of the migration

Options:
      --create[=CREATE]  The table to be created
      --table[=TABLE]    The table to migrate
      --path[=PATH]      The location where the migration file should be created
      --realpath         Indicate any provided migration file paths are pre-resolved absolute paths
      --fullpath         Output the full path of the migration
  -f, --force           Create the class even if the migration already exists

5. Ejemplos prácticos

Quieres saber...Comando
Todos los comandosphp artisan help
Cómo crear un controladorphp artisan help make:controller
Cómo crear un modelophp artisan help make:model
Cómo crear una migraciónphp artisan help make:migration
Cómo crear un seederphp artisan help make:seeder
Cómo crear un FormRequestphp artisan help make:request
Cómo crear una factoryphp artisan help make:factory
Opciones del comando migratephp artisan help migrate
Opciones del comando servephp artisan help serve

6. Comandos útiles para recordar

bash
# Ver todos los comandos disponibles
php artisan list

# Ver solo los comandos make:*
php artisan list make

# Ver solo los comandos de migración
php artisan list migrate

# Buscar un comando específico
php artisan list | grep controller

Comentarios

Entradas más populares de este blog

Tutorial CRUD con Laravel 12-Pastel::factory(50)->create();

CRUD Completo con Laravel 12 - Guía Práctica Paso a Paso-productos

CRUD en Laravel 12 con Git - Guía para Principiantes