| @@ 126-134 (lines=9) @@ | ||
| 123 | * @param \Illuminate\Http\Request $request |
|
| 124 | * @return \Illuminate\Http\Response |
|
| 125 | */ |
|
| 126 | public function show($id) |
|
| 127 | { |
|
| 128 | $sekolah = $this->sekolah->findOrFail($id); |
|
| 129 | ||
| 130 | $response['sekolah'] = $sekolah; |
|
| 131 | $response['status'] = true; |
|
| 132 | ||
| 133 | return response()->json($response); |
|
| 134 | } |
|
| 135 | ||
| 136 | /** |
|
| 137 | * Show the form for editing the specified resource. |
|
| @@ 142-150 (lines=9) @@ | ||
| 139 | * @param \App\Sekolah $sekolah |
|
| 140 | * @return \Illuminate\Http\Response |
|
| 141 | */ |
|
| 142 | public function edit($id) |
|
| 143 | { |
|
| 144 | $sekolah = $this->sekolah->findOrFail($id); |
|
| 145 | ||
| 146 | $response['sekolah'] = $sekolah; |
|
| 147 | $response['status'] = true; |
|
| 148 | ||
| 149 | return response()->json($response); |
|
| 150 | } |
|
| 151 | ||
| 152 | /** |
|
| 153 | * Update the specified resource in storage. |
|
| @@ 207-218 (lines=12) @@ | ||
| 204 | * @param \App\Sekolah $sekolah |
|
| 205 | * @return \Illuminate\Http\Response |
|
| 206 | */ |
|
| 207 | public function destroy($id) |
|
| 208 | { |
|
| 209 | $sekolah = $this->sekolah->findOrFail($id); |
|
| 210 | ||
| 211 | if ($sekolah->delete()) { |
|
| 212 | $response['status'] = true; |
|
| 213 | } else { |
|
| 214 | $response['status'] = false; |
|
| 215 | } |
|
| 216 | ||
| 217 | return json_encode($response); |
|
| 218 | } |
|
| 219 | } |
|
| 220 | ||