diff options
| author | horus | 2022-11-10 23:20:29 +0100 |
|---|---|---|
| committer | horus | 2022-11-10 23:20:29 +0100 |
| commit | ebaf5f009fd609fca29d1135ee9ad9f27d489fc7 (patch) | |
| tree | 8060abd6e39637364dc2d88e2e3886480af65070 | |
| parent | 3afa2d252b531a63543b8e18e577b6886f1a789b (diff) | |
| download | kategorischeraperitif-ebaf5f009fd609fca29d1135ee9ad9f27d489fc7.tar.gz | |
search phrase fix 'und/oder'
| -rw-r--r-- | app/Http/Controllers/CocktailController.php | 11 | ||||
| -rw-r--r-- | resources/views/cocktail_list.blade.php | 14 |
2 files changed, 18 insertions, 7 deletions
diff --git a/app/Http/Controllers/CocktailController.php b/app/Http/Controllers/CocktailController.php index 9c5f096..c81f116 100644 --- a/app/Http/Controllers/CocktailController.php +++ b/app/Http/Controllers/CocktailController.php @@ -94,19 +94,22 @@ class CocktailController extends Controller $search_phrase = ""; foreach(array_filter($ingredients) as $term) { if ( $search_phrase != "" ) - $search_phrase = $search_phrase . " und "; + if ( Str::contains( $request->fullUrl(), 'oder' ) ) + $search_phrase = $search_phrase . " und/oder "; + else + $search_phrase = $search_phrase . " und "; $search_phrase = $search_phrase . ucwords($term); } - $search_phrase = rtrim($search_phrase, " und "); + #$search_phrase = rtrim($search_phrase, " und "); $exclude_phrase = ""; if ( isset($excludes) ) { foreach(array_filter($excludes) as $term) { if ( $exclude_phrase != "" ) - $exclude_phrase = $exclude_phrase . " und "; + $exclude_phrase = $exclude_phrase . " oder "; $exclude_phrase = $exclude_phrase . ucwords($term); } - $exclude_phrase = rtrim($exclude_phrase, " und "); + #$exclude_phrase = rtrim($exclude_phrase, " oder "); } if ( "" != $exclude_phrase) diff --git a/resources/views/cocktail_list.blade.php b/resources/views/cocktail_list.blade.php index 37d5627..8aed633 100644 --- a/resources/views/cocktail_list.blade.php +++ b/resources/views/cocktail_list.blade.php @@ -1,7 +1,11 @@ @extends('layouts.base') @section('header') -Du hast nach {{ implode(" und ", $search_terms) }} gesucht: {{$count}} Cocktails gefunden + @if ( str_contains(Request::fullUrl(), 'oder')) + Du hast nach {{ implode(" und/oder ", $search_terms) }} gesucht: {{$count}} Cocktails gefunden + @else + Du hast nach {{ implode(" und ", $search_terms) }} gesucht: {{$count}} Cocktails gefunden + @endif @endsection @section('styles') @@ -23,8 +27,12 @@ Du hast nach {{ implode(" und ", $search_terms) }} gesucht: {{$count}} Cocktails Du hast nach @foreach( $search_terms as $term ) - @if ( !$loop->first ) - und + @if ( ! $loop->first ) + @if ( str_contains(Request::fullUrl(), 'oder')) + und/oder + @else + und + @endif @endif <strong>{{ $term }}</strong> @endforeach |
