From 3e4f36dff7a7d3ab0f129c9c64499dc59a1ba88f Mon Sep 17 00:00:00 2001 From: Gerardo Ibarra Date: Fri, 10 May 2019 19:34:35 -0300 Subject: [PATCH] Error on associate term to new taxonomy ` $term = new Term(); $term->forceFill([ 'name' => 'My Category', 'slug' => 'my-category', 'term_group' => 0, ]); $term->save(); $category = new Taxonomy(); $category->forceFill([ 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 0, ]); //Here Fail on associate function $category->term()->associate($term); $category->save(); ` --- src/Model/Taxonomy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Taxonomy.php b/src/Model/Taxonomy.php index 7ae782a8..040555b0 100644 --- a/src/Model/Taxonomy.php +++ b/src/Model/Taxonomy.php @@ -96,7 +96,7 @@ public function newQuery() public function __get($key) { if (!isset($this->$key)) { - if (isset($this->term->$key)) { + if ($key!="term_id" && isset($this->term->$key)) { return $this->term->$key; } }