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