Support the ongoing development of Laravel.io →
Artisan Database

Whenever I try to run any database-related Artisan command (e.g. migrate, schema:dump), I get an Array to string conversion error:

❯ php artisan migrate

   ErrorException

  Array to string conversion

  at vendor/laravel/framework/src/Illuminate/Database/Schema/MySqlBuilder.php:41
     37▕      * @return bool
     38▕      */
     39public function hasTable($table)
     40▕     {
  ➜  41$table = $this->connection->getTablePrefix().$table;
     4243return count($this->connection->select(
     44$this->grammar->compileTableExists(), [$this->connection->getDatabaseName(), $table]
     45▕         )) > 0;

      +20 vendor frames
  21  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

This seems to come from $connection->tablePrefix being concatenated with various strings, which would mean that, although it's annotated as a string, it's actually being assigned an array at some point. As far as I know, I didn't change anything related to table prefixes (I didn't even know that that was a thing) from the default Laravel Breeze template.

My project is at https://github.com/aleksrutins/harknology.

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.