lorisleiva / laravel-actions

⚡️ Laravel components that take care of one specific task
https://laravelactions.com
MIT License
2.52k stars 125 forks source link

withProgressBar not work probably #134

Closed thaifani closed 3 years ago

thaifani commented 3 years ago

hi Friend when I work with withProgressBar not work asCommand this code

   $responseContent = $response->collect();
        if ((!count($responseContent)) > 0) {
            Log::info('! We cant find any product');
            abort(304, ('! We cant find any product'));
        }
        //    dd($responseContent);
        $this->productService = new ProductService();
        foreach ($responseContent as $product) {
            $command->withProgressBar(count($responseContent), function () use ($product) {
                try {
                    $this->productService::updateOrCreateProduct($product);
                } catch (\Exception $ex) {
                    Log::error('there are error during sync products'.$ex->getMessage());
                }
            });
        }

product Sync

Wulfheart commented 3 years ago

What terminal do you use? CMD? Bash? Powershell?

lorisleiva commented 3 years ago

Would this work on the same machine if it was executed from inside a "real" Laravel command?

thaifani commented 3 years ago

Would this work on the same machine if it was executed from inside a "real" Laravel command?

Yes

thaifani commented 3 years ago

What terminal do you use? CMD? Bash? Powershell?

git pash

thaifani commented 3 years ago

Ok I was write a wrong code

lorisleiva commented 3 years ago

No worries 🙂