@@ 40-46 (lines=7) @@ | ||
37 | { |
|
38 | if (static::$constraints) { |
|
39 | $this->query |
|
40 | ->whereExists(function (Builder $query) { |
|
41 | $query->select(DB::raw(1)) |
|
42 | ->from('translations as original') |
|
43 | ->whereRaw('original.translation_id = translations.translation_id') |
|
44 | ->where('original.translatable_id', '=', $this->parent->getKey()) |
|
45 | ->where('original.translatable_type', '=', get_class($this->parent)); |
|
46 | }) |
|
47 | ->where('translatable_type', '=', get_class($this->parent)) |
|
48 | ->where('translatable_id', '<>', $this->parent->getKey()); |
|
49 | } |
|
@@ 60-66 (lines=7) @@ | ||
57 | $ids = collect($models)->pluck($this->parent->getKeyName()); |
|
58 | ||
59 | $this->query |
|
60 | ->whereExists(function (Builder $query) use ($ids) { |
|
61 | $query->select(DB::raw(1)) |
|
62 | ->from('translations as original') |
|
63 | ->whereRaw('translations.translation_id = original.translation_id') |
|
64 | ->whereIn('original.translatable_id', $ids) |
|
65 | ->where('original.translatable_type', '=', get_class($this->parent)); |
|
66 | }) |
|
67 | ->where('translatable_type', '=', get_class($this->parent)) |
|
68 | ->whereNotIn('translatable_id', $ids); |
|
69 | } |