diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 7872243..ce4b83e 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -4,14 +4,19 @@ use App\Models\AudioRecord; use NominatimLaravel\Content\Nominatim; +use App\Services\UrlLocaliser; class SearchController extends Controller { - public function __construct(Nominatim $searchApi) { + protected $searchApi; + protected $urlLocaliser; + + public function __construct(Nominatim $searchApi, UrlLocaliser $urlLocaliser) { $this->searchApi = $searchApi; + $this->urlLocaliser = $urlLocaliser; } - public function index(string $locale, string $place) { + public function index(string $locale, string $place = '') { $search = $this->searchApi->newSearch(); $search->query($place)->viewbox(-5.5151, 51.2956, -2.6870, 53.5011); @@ -48,6 +53,7 @@ public function index(string $locale, string $place) { return view('search', [ 'place' => $place, 'results' => $list, + 'urllocaliser' => $this->urlLocaliser ]); } } diff --git a/resources/views/list.blade.php b/resources/views/list.blade.php index 4824030..6becfd5 100644 --- a/resources/views/list.blade.php +++ b/resources/views/list.blade.php @@ -6,13 +6,7 @@
{{ __('This list shows the latest audio clips.') }}
{{ __('Search for a place name to add a new audio clip.') }}
- + @include('search-form')