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 response()->json(['OK']);
  }
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 response()->json(['OK']);
  }
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 response ( ) -> json ( [ 'OK' ] ) ; }
Destory a resource.

@return Response
Destory a resource .