fix tests
This commit is contained in:
parent
dece5c8d0a
commit
e409cf68f9
2 changed files with 3 additions and 4 deletions
|
@ -96,13 +96,13 @@ class MicropubController extends Controller
|
||||||
$data['published'] = $request->input('properties.published')[0];
|
$data['published'] = $request->input('properties.published')[0];
|
||||||
//create checkin place
|
//create checkin place
|
||||||
if (array_key_exists('checkin', $request->input('properties'))) {
|
if (array_key_exists('checkin', $request->input('properties'))) {
|
||||||
$data['checkin'] = $request->input('properties.checkin.0.properties.url.0');
|
|
||||||
$data['swarm-url'] = $request->input('properties.syndication.0');
|
$data['swarm-url'] = $request->input('properties.syndication.0');
|
||||||
try {
|
try {
|
||||||
$place = $this->placeService->createPlaceFromCheckin($request->input('properties.checkin.0'));
|
$place = $this->placeService->createPlaceFromCheckin($request->input('properties.checkin.0'));
|
||||||
$data['checkin'] = $place->longurl;
|
$data['checkin'] = $place->longurl;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$data['checkin'] = null;
|
$data['checkin'] = null;
|
||||||
|
$data['swarm-url'] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -46,8 +46,7 @@ class NoteService
|
||||||
//uri of form http://host/places/slug, we want slug
|
//uri of form http://host/places/slug, we want slug
|
||||||
//get the URL path, then take last part, we can hack with basename
|
//get the URL path, then take last part, we can hack with basename
|
||||||
//as path looks like file path.
|
//as path looks like file path.
|
||||||
$slug = basename(parse_url($data['location'], PHP_URL_PATH));
|
$place = Place::where('slug', basename(parse_url($data['location'], PHP_URL_PATH)))->first();
|
||||||
$place = Place::where('slug', $slug)->first();
|
|
||||||
$note->place()->associate($place);
|
$note->place()->associate($place);
|
||||||
}
|
}
|
||||||
if (substr($data['location'], 0, 4) == 'geo:') {
|
if (substr($data['location'], 0, 4) == 'geo:') {
|
||||||
|
@ -61,7 +60,7 @@ class NoteService
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('checkin', $data) && $data['checkin'] !== null) {
|
if (array_key_exists('checkin', $data) && $data['checkin'] !== null) {
|
||||||
$place = Place::where('foursquare', $data['checkin'])->first();
|
$place = Place::where('slug', basename(parse_url($data['checkin'], PHP_URL_PATH)))->first();
|
||||||
if ($place !== null) {
|
if ($place !== null) {
|
||||||
$note->place()->associate($place);
|
$note->place()->associate($place);
|
||||||
$note->swarm_url = $data['swarm-url'];
|
$note->swarm_url = $data['swarm-url'];
|
||||||
|
|
Loading…
Add table
Reference in a new issue