thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.77k stars 2.67k forks source link

The command "voyager:install" does not exist. #5721

Closed elmarzouguidev closed 1 year ago

elmarzouguidev commented 1 year ago

Laravel version

9.46.0

PHP version

8.1

Voyager version

1.6

Database

7

Description

when i call voyager:install from Artisan facade like :

` public function voyagerInstall(bool $withDummy = false) {

    Artisan::call('voyager:install', [
        '--with-dummy' =>  $withDummy,
    ]);
}`

it's throw this exception : Symfony  \  Component  \  Console  \  Exception  \  CommandNotFoundException The command "voyager:install" does not exist.

Steps to reproduce

no solution

Expected behavior

no

Screenshots

no

Additional context

no

rahat1994 commented 1 year ago

can you elaborate more on your problem? was it working on previous versions of Laravel?

Because Voyager is registering its commands only when the app is running in the console. in VoyagerServiceProvider

        if ($this->app->runningInConsole()) {
            $this->registerPublishableResources();
            $this->registerConsoleCommands();
        }

you can easily run this command programmatically by including the command in the file: app/Console/Kernel.php

    protected $commands = [
        \TCG\Voyager\Commands\InstallCommand::class
    ];
elmarzouguidev commented 1 year ago

can you elaborate more on your problem? was it working on previous versions of Laravel?

Because Voyager is registering its commands only when the app is running in the console. in VoyagerServiceProvider

        if ($this->app->runningInConsole()) {
            $this->registerPublishableResources();
            $this->registerConsoleCommands();
        }

you can easily run this command programmatically by including the command in the file: app/Console/Kernel.php

    protected $commands = [
        \TCG\Voyager\Commands\InstallCommand::class
    ];

thanks brother

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.