Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console Output Unsuccessful When Invoked Via Artisan::call() Command #2

Open
Blue-Kachina opened this issue Sep 19, 2023 · 1 comment

Comments

@Blue-Kachina
Copy link

I've got a simple Artisan command that consumes this library.
The command works as intended when invoked directly from the command line (ex: php artisan post-migrate:members).

    public function handle()
    {
        Console::section('section')->info('Converting all the NON-MEMBERS to MEMBERS');
        Console::section('section')->withProgressBar(
            ["Everything happens in a single batch so we don't need an iterator here"],
            fn($value, $bar) => $this->makeNonMembersIntoMembers($value, $bar)
        );
    }

    public function makeNonMembersIntoMembers($value, $bar): void
    {
        User::whereRole(User::ROLE_NON_MEMBER)->update([
            'role' => User::ROLE_MEMBER
        ]);
    }

I'm now trying to automatically invoke this command from my DatabaseSeeder.php using Artisan::call('post-migrate:members'); and it's producing an error (see attached screenshot).

image

@Blue-Kachina
Copy link
Author

Using:
Laravel 8.83.27
henzeb/laravel-console-facade v1.13.2
Host OS: Windows 10, using WSL2 (Ubuntu 22) and Docker containers for dev environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant