/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id_kategori, $id_artikel) { if (Request::isMethod('get')) { $this->data = array(); $this->data['artikel'] = Artikel::find($id_artikel); return View::make('admin.article.delete', $this->data); } else { if (Request::isMethod('post')) { $data = Input::all(); Artikel::where('id', $id_artikel)->delete(); return redirect('admin/artikel/' . $id_kategori); } } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($jenis, $id) { if ($jenis == "artikel") { $data = Artikel::find($id); $data->delete(); return redirect('/bos/artikel'); } if ($jenis == "kategori") { $data = Kategori::find($id); $data->delete(); return redirect('/bos/kategori'); } }
public function destroy($id) { $vote = DB::table('votes')->where('artikel_id', $id); $vote->delete(); $comment = DB::table('comments')->where('artikel_id', $id); $comment->delete(); Session::put('notiftype', 'success'); Session::put('notifmessage', 'Article deleted successfully'); Artikel::find($id)->delete(); return redirect('/home'); }