• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RonasIT / laravel-helpers / 14753340340

30 Apr 2025 11:20AM UTC coverage: 77.669% (+0.08%) from 77.591%
14753340340

Pull #204

github

web-flow
Merge 8565e9e88 into 5a454cc9c
Pull Request #204: refactor: rmake valid nullable value for optional arguments in mock

6 of 6 new or added lines in 1 file covered. (100.0%)

1113 of 1433 relevant lines covered (77.67%)

12.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Traits/TranslationUpdateTrait.php
1
<?php
2

3
namespace RonasIT\Support\Traits;
4

5
use Illuminate\Support\Arr;
6

7
trait TranslationUpdateTrait
8
{
9
    public function updateWithTranslations($id, $data)
10
    {
11
        $translations = Arr::pull($data, 'translations');
×
12

13
        if (empty($translations)) {
×
14
            return $this->update(['id' => $id], $data);
×
15
        }
16

17
        $modelInstance = new $this->model();
×
18

19
        $foreignKey = $modelInstance->allTranslations()->getForeignKeyName();
×
20

21
        $translationModel = $modelInstance->getTranslationClass();
×
22

23
        foreach ($translations as $translation) {
×
24
            $translationModel::where([
×
25
                $foreignKey => $id,
×
26
                'locale' => $translation['locale'],
×
27
            ])->update($translation);
×
28
        }
29

30
        return $this->withRelations(['allTranslations'])->find($id);
×
31
    }
32
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc