Laravel Postgres SQLSTATE[42601]:语法错误:7错误:零长度分隔标识符位于或接近&引用&引用&引用;
我正在尝试使用laravel对数据进行种子设定,但尽管我尝试将所有Laravel Postgres SQLSTATE[42601]:语法错误:7错误:零长度分隔标识符位于或接近&引用&引用&引用;,laravel,Laravel,我正在尝试使用laravel对数据进行种子设定,但尽管我尝试将所有“替换为” 我的代码 foreach ($groupPermissionsStructure as $groupName => $permissionStructure) { $group = collect($groups->where('alias', $groupName)->first()); if ($group->isNotEmpty()) {
“
替换为”
我的代码
foreach ($groupPermissionsStructure as $groupName => $permissionStructure) {
$group = collect($groups->where('alias', $groupName)->first());
if ($group->isNotEmpty()) {
$group = Group::firstOrCreate([
'name' => $group['name'],
'alias' => strtolower($group['alias']),
'description' => $group['description'],
'organization_id' => 1,
'status' => 1,
]);
$names = explode(" ", $group['name']);
$domain = str_replace([" ", "-", "_"], "", $groupName);
User::firstOrCreate([
'first_name' => $names[0],
'last_name' => isset($names[1]) ? $names[1] : $names[0],
'email' => $domain . '@test.com',
'email_verified_at' => Carbon::now(),
'status' => config('constants.status.active'),
'group_id' => $group->id,
'password' => Hash::make($domain)
]);
}
我的错误
SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier at or near """"
LINE 1: select * from ""."groups" where ("name" = $1 and "alias" = $...
^ (SQL: select * from ""."groups" where ("name" = Super Administrator and "alias" = super_administrator and "description" = Overall system super administrator and "organization_id" = 1 and "status" = 1) and ""."groups"."deleted_at" is null limit 1)
发生此错误的原因是,尽管数据库凭据已更正,但我没有在我的env文件中指定我的“DB_架构”。发生此错误的原因是,尽管数据库凭据正确,我没有在我的env文件中指定我的“DB_架构”