reliese / laravel

Reliese Laravel Model Generator
MIT License
1.49k stars 316 forks source link

foreach() argument must be of type array|object, null given #287

Open yowgerald opened 5 months ago

yowgerald commented 5 months ago

I encountered an error while using MySQL as the database in a Docker container. Below are the details of my composer.json file:

root@a22dd90f1c16:/var/www/html# php artisan code:models --table=table_xxx

   ErrorException 

  foreach() argument must be of type array|object, null given

  at vendor/reliese/laravel/src/Meta/MySql/Schema.php:106
    102▕      */
    103▕     protected function fillColumns(Blueprint $blueprint)
    104▕     {
    105▕         $rows = $this->arraify($this->connection->select('SHOW FULL COLUMNS FROM '.$this->wrap($blueprint->qualifiedTable())));
  ➜ 106▕         foreach ($rows as $column) {
    107▕             $blueprint->withColumn(
    108▕                 $this->parseColumn($column)
    109▕             );
    110▕         }

      +24 vendor frames 

  25  artisan:12
      Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))

Could you please help me identify and resolve the issue? Any guidance or suggestions would be greatly appreciated.

Thank you!