public function tearDown() { parent::tearDown(); $taxonomy = TermTaxonomy::where('taxonomy', '=', 'stuff')->first(); if ($taxonomy !== null) { $taxonomy->delete(); } }
public function categories() { $categories = array(); $post_id = $this->ID; $related_taxonomies = TermTaxonomy::where('taxonomy', 'category')->whereHas('relationships', function ($q) use($post_id) { $q->where('object_id', $post_id); })->get(); foreach ($related_taxonomies as $taxonomy) { $categories[] = $taxonomy->term()->first(); } return $categories; }