How to echo to console in Laravel and Artisan?

前端 未结 7 1928
鱼传尺愫
鱼传尺愫 2021-02-03 21:02

I was curious, I\'m using Laravel and Artisan for my migrations. Is there a method to output information to the console? I can\'t seem to find any information on this. For examp

相关标签:
7条回答
  • 2021-02-03 22:03

    This works for me

    use Symfony\Component\Console\Output\ConsoleOutput;
    
    class MigrateData {
    
        public function up()
        {
            $output = new ConsoleOutput();
    
            for($i=0; $i<50000; $i++)
            {
                 $output->writeln('Converting '.$i.' of 50000');
            }
         }
    }
    

    I have a migration which is converting a large table into a more efficient format and use this to get some progress while it works.

    0 讨论(0)
提交回复
热议问题