/** * Destory a resource. * * @return Response */ public function deleteDestroy($id) { $vocabulary = $this->vocabulary->find($id); $terms = $vocabulary->terms->lists('id')->toArray(); TermRelation::whereIn('term_id', $terms)->delete(); Term::destroy($terms); $this->vocabulary->destroy($id); return Redirect::back(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function deleteDestroy($id) { // Delete children if any exist Term::whereParent($id)->delete(); // Delete Term Term::destroy($id); return Redirect::back(); }