From 36c3fac33ba929cbb2746ba9797be91c5a3631c4 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Mon, 24 Oct 2016 18:35:48 +0100 Subject: [PATCH] =?UTF-8?q?Markup=20locations=20that=20aren=E2=80=99t=20pl?= =?UTF-8?q?aces=20in=20h-adr=20markup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/NotesController.php | 11 ++++++----- database/seeds/NotesTableSeeder.php | 4 ++++ resources/views/templates/note.blade.php | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/NotesController.php b/app/Http/Controllers/NotesController.php index 3d9c2eff..cf9c13d1 100644 --- a/app/Http/Controllers/NotesController.php +++ b/app/Http/Controllers/NotesController.php @@ -283,7 +283,7 @@ class NotesController extends Controller * * @param float The latitude * @param float The longitude - * @return string The location name + * @return string The location HTML */ public function reverseGeoCode(float $latitude, float $longitude): string { @@ -303,7 +303,7 @@ class NotesController extends Controller ]); $json = json_decode($response->getBody()); if (isset($json->address->town)) { - $address = $json->address->town . ', ' . $json->address->country; + $address = '' . $json->address->town . ', ' . $json->address->country . ''; Cache::forever($latlng, $address); return $address; @@ -315,14 +315,15 @@ class NotesController extends Controller return $address; } if (isset($json->address->county)) { - $address = $json->address->county . ', ' . $json->reversegeocode->country; + $address = '' . $json->address->county . ', ' . $json->address->country . ''; Cache::forever($latlng, $address); return $address; } - Cache::forever($latlng, $json->address->country); + $adress = '' . $json->address->country . ''; + Cache::forever($latlng, $address); - return $json->reversegeocode->addressparts->country; + return $address; }); } } diff --git a/database/seeds/NotesTableSeeder.php b/database/seeds/NotesTableSeeder.php index 9fa8ccd1..58add2e3 100644 --- a/database/seeds/NotesTableSeeder.php +++ b/database/seeds/NotesTableSeeder.php @@ -35,5 +35,9 @@ class NotesTableSeeder extends Seeder mkdir(public_path() . '/assets/profile-images/aaronparecki.com', 0755); copy(base_path() . '/tests/aaron.png', public_path() . '/assets/profile-images/aaronparecki.com/image'); } + $noteWithCoords = App\Note::create([ + 'note' => 'Note from somehwere', + 'location' => '53.499,-2.379' + ]); } } diff --git a/resources/views/templates/note.blade.php b/resources/views/templates/note.blade.php index 17a12e46..b32cb058 100644 --- a/resources/views/templates/note.blade.php +++ b/resources/views/templates/note.blade.php @@ -16,7 +16,7 @@
@if($note->client_name) via {{ $note->client_name }}@endif - @if($note->address)in @if($note->placeLink)@endif{{ $note->address }}@if($note->placeLink)@endif@endif + @if($note->address)in {!! $note->address !!}@endif @if($note->replies > 0)Replies: {{ $note->replies }}@endif @if($note->tweet_id)@include('templates.social-links', ['tweet_id' => $note->tweet_id, 'nb60id' => $note->nb60id])@endif @if ($note->placeLink)