Terms table:
term_id
name
slug
Term_taxonomy table:
term_taxonomy_id
term_id
description
My Term model:
public function TermTaxonomy(){
return $this->hasOne('TermTaxonomy');
}
My TermTaxonomy model:
public function Term(){
return $this->belongsTo('Term');
}
I want to delete related data from Terms
and Term_taxonomy
Table , as I do so far is:
$category = Term::with('TermTaxonomy')->find($id);
// delete related
$category->TermTaxonomy()->delete();
$category->delete();
It works, but is there any best way method to delete related data and how to use it?