/** * Show the profile for the given user. * * @param int $id * @return Response */ public function showLocation($id) { $location = Location::findOrFail($id); $transformer = new \App\ViewHelpers\DirectionJsonTransformer(); $directionInJsonFormat = $transformer->getDirectionsAsJson($location->directions); return view('location', ['location' => $location, 'directions' => $directionInJsonFormat]); }
public function get(APIRequest $request, $id) { $location = Location::findOrFail($id); $resource = new Item($location, new LocationTransformer(), 'location'); return $this->fractal->createData($resource)->toArray(); }