public function scopeSearch(Builder $query, ?string $search = null, ?string $lang = null): Builder 	{ 		$search = preg_replace('/\s+/', '%', $search ?? ''); 		$search = empty($search) ? null : '%' . $search . '%';  		return !$search ? $query : $query->where(function ($query) use ($search) { 			$query->where('name', 'like', $search) 				->orWhere('slug', 'like', $search); 		})->when($lang && ($lang !== static::defaultTranslationLocale()), function ($query) use ($search) { 			$query->orWhere(function ($query) use ($search) { 				$query->whereHas('translations', function ($query) use ($search) { 					$query->where('column', 'name')->where(function ($query) use ($search) { 						$query->orWhere('value', 'like', $search); 					})->orWhere('column', 'slug')->where(function ($query) use ($search) { 						$query->orWhere('value', 'like', $search); 					}); 				}); 			}); 		}); 	}