Skip to content

Commit

Permalink
Fixed TypeError Argument #1 ($table) must be of type stdClass, array …
Browse files Browse the repository at this point in the history
…given
  • Loading branch information
andrey-helldar committed Mar 14, 2024
1 parent 3c67736 commit a8d661a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Database/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ protected function columns(string $table): array

protected function filteredTables(array $tables, string $key): array
{
return array_filter($tables, static function (stdClass $table) use ($key) {
return $table->{$key} !== 'migrations';
return array_filter($tables, static function (array|stdClass $table) use ($key) {
$name = is_array($table) ? $table['name'] : $table->{$key};

return $name !== 'migrations';
});
}

protected function pluckTableNames(array $tables, string $key): array
{
return array_map(static function ($table) use ($key) {
return $table->{$key};
return array_map(static function (array|stdClass $table) use ($key) {
return is_array($table) ? $table['name'] : $table->{$key};
}, $tables);
}

Expand Down

0 comments on commit a8d661a

Please sign in to comment.