Example #1
0
 public function petakecamatan(Request $request, $id)
 {
     if ($request->input('limit') == '') {
         return response()->json(['error' => false, 'kecamatan' => Kecamatan::whereId($id)->pluck('nama_kecamatan'), 'peta' => Peta::with('kecamatan.kabupaten', 'kategori', 'foto')->whereKecamatanId($id)->orderBy('id', 'DESC')->get()]);
     } else {
         return response()->json(['error' => false, 'kecamatan' => Kecamatan::whereId($id)->pluck('nama_kecamatan'), 'peta' => Peta::with('kecamatan.kabupaten', 'kategori', 'foto')->whereKecamatanId($id)->orderBy('id', 'DESC')->take($request->input('limit'))->get()]);
     }
 }