skip to Main Content

I’m using Laravel 11. When I run php artisan make:model, I am prompted to give a name and choose additional options (e.g., factory, migration, seeder), but I can’t navigate through them using arrow keys. Instead, I have to type the option name, so it only makes me select one.

terminal

I’ve tried using different terminals (Command Prompt, PowerShell, Git Bash) and running it in VSCode’s integrated terminal on Windows, but the issue persists. I should be able to use the arrow keys to navigate and the spacebar to select multiple options, allowing me to generate the model, migration, factory, seeder, etc., all at once.

2

Answers


  1. I’ve never heard of this interactive menu, so I can’t help you with that. In my environment, when I run php artisan make:model MyModel, it doesn’t show any menu, it just generates the model.

    But you can still achieve what you’re looking for using flags.

    For instance, if you want to create a Model and a Factory:

    php artisan make:model Task --factory
    

    or even:

    php artisan make:model Task -f
    

    Here are the other options you can use:

    • Seeder: --seed or -s
    • Factory: --factory or -f
    • Controller: --controller or -c
    • Resource: --resource or -r
    • Request --requests or -R
    • Policy: --policy or -p
    • Migration: --migration or -m
    • Pivot model: --pivot or -p

    So even without a menu, you can use these commands to get the desired setup. You can also combine them.

    Edit:

    I tried running php artisan make:model without a model name, and it prompted me for the model name and options. However, there were no arrows, so I had to type the options manually. I can specify multiple options by separating them with commas.

    Login or Signup to reply.
  2. The reasons is, laravel prompt not support multi-select in windows cmd, powershell or even in git bash. you can read the full documentation here https://laravel.com/docs/11.x/prompts#fallbacks

    example on windows terminal

    If you want to reproduce the select menu, use WSL2 instead on windows machine

    example on wsl2

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search