Skip to content

Commit

Permalink
Update Database.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mohrajab authored Oct 9, 2019
1 parent 5e2edee commit ae80fa1
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions src/Drivers/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,24 @@ public function addGroupTranslation($language, $group, $key, $value = '')
$this->addLanguage($language);
}

Language::where('language', $language)
->first()
->translations()
->updateOrCreate([
'group' => $group,
'key' => $key,
], [
$translation=Translation::whereGroup($group)->whereKey($key)->first();
if(!$translation)
Translation::create([
'group' => $group,
'key' => $key,
'value' => $value,
]);
// Language::where('language', $language)
// ->first()
// ->translations()
// ->updateOrCreate([
// 'group' => $group,
// 'key' => $key,
// ], [
// 'group' => $group,
// 'key' => $key,
// 'value' => $value,
// ]);
}

/**
Expand All @@ -129,17 +136,24 @@ public function addSingleTranslation($language, $vendor, $key, $value = '')
if (! $this->languageExists($language)) {
$this->addLanguage($language);
}

Language::where('language', $language)
->first()
->translations()
->updateOrCreate([
'group' => $vendor,
'key' => $key,
], [

$translation=Translation::whereNull('group')->whereKey($key)->first();
if(!$translation)
Translation::create([
'key' => $key,
'value' => $value,
]);
]);

// Language::where('language', $language)
// ->first()
// ->translations()
// ->updateOrCreate([
// 'group' => $vendor,
// 'key' => $key,
// ], [
// 'key' => $key,
// 'value' => $value,
// ]);
}

/**
Expand Down

0 comments on commit ae80fa1

Please sign in to comment.