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

Error on seeding #3

Open
tekord opened this issue Nov 21, 2023 · 2 comments
Open

Error on seeding #3

tekord opened this issue Nov 21, 2023 · 2 comments

Comments

@tekord
Copy link

tekord commented Nov 21, 2023

Just installed this package into MoonShine v1.64 project and followed your instructions in README: ran migrations, published config, etc. Then I made a new console command to seed my database:

settings([
            ['group.setting1' => 'Value1'],
            ['group.setting2' => 'Value2'],
            ['group.setting3' => 'Value3'],
            ['setting1' => 'Value4'],
            ['setting2' => 'Value5'],
            ['setting3' => 'Value6'],
            ['setting4' => 'Value7'],
            ['setting5' => 'Value8']
        ]);

Then tried to run the command and got the following error:


   Illuminate\Database\QueryException 

  Array to string conversion (Connection: mysql, SQL: insert into `settings` (`setting_group_id`, `slug`, `value`, `updated_at`, `created_at`) values (?, 0, ?, 2023-11-21 10:36:25, 2023-11-21 10:36:25))

  at vendor\laravel\framework\src\Illuminate\Database\Connection.php:822
    818тЦХ                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    819тЦХ                 );
    820тЦХ             }
    821тЦХ 
  тЮЬ 822тЦХ             throw new QueryException(
    823тЦХ                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    824тЦХ             );
    825тЦХ         }
    826тЦХ     }

  1   vendor\laravel\framework\src\Illuminate\Database\Connection.php:722
      ErrorException::("Array to string conversion")

  2   vendor\laravel\framework\src\Illuminate\Database\Connection.php:722
      PDOStatement::bindValue(["Value1"])
@alexvenga
Copy link
Member

Can you show me full error info?
Screenshot 2023-11-21 at 13 57 59

@tekord
Copy link
Author

tekord commented Nov 21, 2023

here is the log dump:

[2023-11-21 10:35:41] local.ERROR: Array to string conversion (Connection: mysql, SQL: insert into `settings` (`setting_group_id`, `slug`, `value`, `updated_at`, `created_at`) values (?, 0, ?, 2023-11-21 10:35:41, 2023-11-21 10:35:41)) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 0): Array to string conversion (Connection: mysql, SQL: insert into `settings` (`setting_group_id`, `slug`, `value`, `updated_at`, `created_at`) values (?, 0, ?, 2023-11-21 10:35:41, 2023-11-21 10:35:41)) at G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:822)
[stacktrace]
#0 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(776): Illuminate\\Database\\Connection->runQueryCallback('insert into `se...', Array, Object(Closure))
#1 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(581): Illuminate\\Database\\Connection->run('insert into `se...', Array, Object(Closure))
#2 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(533): Illuminate\\Database\\Connection->statement('insert into `se...', Array)
#3 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Processors\\Processor.php(32): Illuminate\\Database\\Connection->insert('insert into `se...', Array)
#4 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php(3387): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into `se...', Array, 'id')
#5 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1968): Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')
#6 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(1340): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)
#7 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(1305): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)
#8 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(1144): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder))
#9 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1023): Illuminate\\Database\\Eloquent\\Model->save()
#10 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\helpers.php(307): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}(Object(VI\\LaravelSiteSettings\\Models\\Setting))
#11 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1024): tap(Object(VI\\LaravelSiteSettings\\Models\\Setting), Object(Closure))
#12 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(583): Illuminate\\Database\\Eloquent\\Builder->create(Array)
#13 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1726): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}()
#14 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(583): Illuminate\\Database\\Eloquent\\Builder->withSavepointIfNeeded(Object(Closure))
#15 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(570): Illuminate\\Database\\Eloquent\\Builder->createOrFirst(Array, Array)
#16 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(598): Illuminate\\Database\\Eloquent\\Builder->firstOrCreate(Array, Array)
#17 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Traits\\ForwardsCalls.php(23): Illuminate\\Database\\Eloquent\\Builder->updateOrCreate(Array, Array)
#18 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(2341): Illuminate\\Database\\Eloquent\\Model->forwardCallTo(Object(Illuminate\\Database\\Eloquent\\Builder), 'updateOrCreate', Array)
#19 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(2353): Illuminate\\Database\\Eloquent\\Model->__call('updateOrCreate', Array)
#20 G:\\xampp\\www\\moonshine-sandbox\\vendor\\visual-ideas\\laravel-site-settings\\src\\LaravelSiteSettings.php(140): Illuminate\\Database\\Eloquent\\Model::__callStatic('updateOrCreate', Array)
#21 G:\\xampp\\www\\moonshine-sandbox\\vendor\\visual-ideas\\laravel-site-settings\\src\\LaravelSiteSettings.php(84): VI\\LaravelSiteSettings\\LaravelSiteSettings->saveToDB(0, Array)
#22 G:\\xampp\\www\\moonshine-sandbox\\vendor\\visual-ideas\\laravel-site-settings\\src\\helpers.php(21): VI\\LaravelSiteSettings\\LaravelSiteSettings->set(0)
#23 G:\\xampp\\www\\moonshine-sandbox\\app\\Console\\Commands\\App_DB_Init.php(12): settings(Array)
#24 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): App\\Console\\Commands\\App_DB_Init->handle()
#25 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#26 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#27 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#28 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#29 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(211): Illuminate\\Container\\Container->call(Array)
#30 G:\\xampp\\www\\moonshine-sandbox\\vendor\\symfony\\console\\Command\\Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#31 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(181): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#32 G:\\xampp\\www\\moonshine-sandbox\\vendor\\symfony\\console\\Application.php(1081): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#33 G:\\xampp\\www\\moonshine-sandbox\\vendor\\symfony\\console\\Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand(Object(App\\Console\\Commands\\App_DB_Init), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#34 G:\\xampp\\www\\moonshine-sandbox\\vendor\\symfony\\console\\Application.php(174): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#35 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#36 G:\\xampp\\www\\moonshine-sandbox\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#37 {main}

[previous exception] [object] (ErrorException(code: 0): Array to string conversion at G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:722)
[stacktrace]
#0 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\HandleExceptions.php(254): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'Array to string...', 'G:\\\\xampp\\\\www\\\\fi...', 722)
#1 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(2, 'Array to string...', 'G:\\\\xampp\\\\www\\\\fi...', 722)
#2 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(722): PDOStatement->bindValue(3, Array, 2)
#3 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(576): Illuminate\\Database\\Connection->bindValues(Object(PDOStatement), Array)
#4 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(809): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}('insert into `se...', Array)
#5 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(776): Illuminate\\Database\\Connection->runQueryCallback('insert into `se...', Array, Object(Closure))
#6 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(581): Illuminate\\Database\\Connection->run('insert into `se...', Array, Object(Closure))
#7 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php(533): Illuminate\\Database\\Connection->statement('insert into `se...', Array)
#8 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Processors\\Processor.php(32): Illuminate\\Database\\Connection->insert('insert into `se...', Array)
#9 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Query\\Builder.php(3387): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into `se...', Array, 'id')
#10 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1968): Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')
#11 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(1340): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)
#12 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(1305): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)
#13 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(1144): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder))
#14 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1023): Illuminate\\Database\\Eloquent\\Model->save()
#15 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\helpers.php(307): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}(Object(VI\\LaravelSiteSettings\\Models\\Setting))
#16 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1024): tap(Object(VI\\LaravelSiteSettings\\Models\\Setting), Object(Closure))
#17 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(583): Illuminate\\Database\\Eloquent\\Builder->create(Array)
#18 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(1726): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}()
#19 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(583): Illuminate\\Database\\Eloquent\\Builder->withSavepointIfNeeded(Object(Closure))
#20 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(570): Illuminate\\Database\\Eloquent\\Builder->createOrFirst(Array, Array)
#21 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Builder.php(598): Illuminate\\Database\\Eloquent\\Builder->firstOrCreate(Array, Array)
#22 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Traits\\ForwardsCalls.php(23): Illuminate\\Database\\Eloquent\\Builder->updateOrCreate(Array, Array)
#23 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(2341): Illuminate\\Database\\Eloquent\\Model->forwardCallTo(Object(Illuminate\\Database\\Eloquent\\Builder), 'updateOrCreate', Array)
#24 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Model.php(2353): Illuminate\\Database\\Eloquent\\Model->__call('updateOrCreate', Array)
#25 G:\\xampp\\www\\moonshine-sandbox\\vendor\\visual-ideas\\laravel-site-settings\\src\\LaravelSiteSettings.php(140): Illuminate\\Database\\Eloquent\\Model::__callStatic('updateOrCreate', Array)
#26 G:\\xampp\\www\\moonshine-sandbox\\vendor\\visual-ideas\\laravel-site-settings\\src\\LaravelSiteSettings.php(84): VI\\LaravelSiteSettings\\LaravelSiteSettings->saveToDB(0, Array)
#27 G:\\xampp\\www\\moonshine-sandbox\\vendor\\visual-ideas\\laravel-site-settings\\src\\helpers.php(21): VI\\LaravelSiteSettings\\LaravelSiteSettings->set(0)
#28 G:\\xampp\\www\\moonshine-sandbox\\app\\Console\\Commands\\App_DB_Init.php(12): settings(Array)
#29 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): App\\Console\\Commands\\App_DB_Init->handle()
#30 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#31 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#32 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#33 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#34 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(211): Illuminate\\Container\\Container->call(Array)
#35 G:\\xampp\\www\\moonshine-sandbox\\vendor\\symfony\\console\\Command\\Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#36 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(181): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#37 G:\\xampp\\www\\moonshine-sandbox\\vendor\\symfony\\console\\Application.php(1081): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#38 G:\\xampp\\www\\moonshine-sandbox\\vendor\\symfony\\console\\Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand(Object(App\\Console\\Commands\\App_DB_Init), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#39 G:\\xampp\\www\\moonshine-sandbox\\vendor\\symfony\\console\\Application.php(174): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#40 G:\\xampp\\www\\moonshine-sandbox\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#41 G:\\xampp\\www\\moonshine-sandbox\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#42 {main}
"} 

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

2 participants