Conditions | 3 |
Paths | 4 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Rocket\Translation\Model; |
||
32 | public static function setTranslation($stringId, $languageId, $text) { |
||
33 | $translation = Translation::where('string_id', $stringId)->where('language_id', $languageId)->first(); |
||
34 | |||
35 | if (!$translation) { |
||
36 | $translation = new Translation(); |
||
37 | $translation->string_id = $stringId; |
||
38 | $translation->language_id = $languageId; |
||
39 | } |
||
40 | |||
41 | $translation->text = $text; |
||
42 | |||
43 | if ($translation->isDirty()) { |
||
44 | $translation->date_edition = Carbon::now(); |
||
45 | } |
||
46 | |||
47 | $translation->save(); |
||
48 | |||
49 | return $translation; |
||
50 | } |
||
51 | |||
57 |