/** * @param $city * * @return \Illuminate\Http\JsonResponse */ public function barangays($city) { $b = new Barangay(); $barangays = $b->whereCityId($city)->orderBy('name')->get(['id', 'name']); return response()->json(['type' => 'success', 'message' => 'success', 'data' => $barangays]); }