| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 66 | public function findByUrl(string $url, $with = []) |
||
| 67 | { |
||
| 68 | $model = static::MODEL; |
||
| 69 | |||
| 70 | $locale = content_locale(); |
||
| 71 | |||
| 72 | if (!isset((new $model())->translatedAttributes)) { |
||
| 73 | return $this->query() |
||
| 74 | ->online() |
||
| 75 | ->where('url', 'regexp', "\"{$locale}\"\s*:\s*\"{$url}\"") |
||
| 76 | ->first(); |
||
| 77 | } |
||
| 78 | |||
| 79 | return $this->query() |
||
| 80 | ->with($with) |
||
| 81 | ->online() |
||
| 82 | ->whereTranslation('url', $url, $locale) |
||
| 83 | ->first(); |
||
| 84 | } |
||
| 85 | |||
| 91 |