| @@ 137-145 (lines=9) @@ | ||
| 134 | * @param \Illuminate\Http\Request $request |
|
| 135 | * @return \Illuminate\Http\Response |
|
| 136 | */ |
|
| 137 | public function show($id) |
|
| 138 | { |
|
| 139 | $nilai = $this->nilai->findOrFail($id); |
|
| 140 | ||
| 141 | $response['nilai'] = $nilai; |
|
| 142 | $response['status'] = true; |
|
| 143 | ||
| 144 | return response()->json($response); |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * Show the form for editing the specified resource. |
|
| @@ 153-162 (lines=10) @@ | ||
| 150 | * @param \App\Nilai $nilai |
|
| 151 | * @return \Illuminate\Http\Response |
|
| 152 | */ |
|
| 153 | public function edit($id) |
|
| 154 | { |
|
| 155 | $nilai = $this->nilai->findOrFail($id); |
|
| 156 | ||
| 157 | $response['nilai'] = $nilai; |
|
| 158 | $response['siswa'] = $nilai->siswa; |
|
| 159 | $response['status'] = true; |
|
| 160 | ||
| 161 | return response()->json($response); |
|
| 162 | } |
|
| 163 | ||
| 164 | /** |
|
| 165 | * Update the specified resource in storage. |
|
| @@ 223-234 (lines=12) @@ | ||
| 220 | * @param \App\Nilai $nilai |
|
| 221 | * @return \Illuminate\Http\Response |
|
| 222 | */ |
|
| 223 | public function destroy($id) |
|
| 224 | { |
|
| 225 | $nilai = $this->nilai->findOrFail($id); |
|
| 226 | ||
| 227 | if ($nilai->delete()) { |
|
| 228 | $response['status'] = true; |
|
| 229 | } else { |
|
| 230 | $response['status'] = false; |
|
| 231 | } |
|
| 232 | ||
| 233 | return json_encode($response); |
|
| 234 | } |
|
| 235 | } |
|
| 236 | ||