'array']; public function sluggable() { return [ 'slug' => [ 'source' => 'name' ] ]; } public function iq_content_tree() { return $this->belongsTo('App\Models\IQContentTree', 'tree_id'); } public function iq_content_tree_node_parent() { return $this->belongsTo('App\Models\IQContentTreeNode', 'parent_id'); } public function iq_content_tree_node_childs() { return $this->hasMany('App\Models\IQContentTreeNode', 'parent_id', 'id'); } public function travel_guides() { return $this->hasMany('App\Models\TravelGuide', 'tree_node_id', 'id'); } public function setIdentifierAttribute( $value ) { if(!isset($value) || $value == ""){ $this->attributes['identifier'] = Str::slug(pre_slug($this->name), '-'); }else{ $this->attributes['identifier'] = Str::slug(pre_slug($value), '-'); } } public function getUri(){ $root = $this->iq_content_tree->identifier."/"; $ret = $this->getParentIdentifier(); return $root.$ret.$this->identifier."/"; } public function getParentIdentifier(){ if($node_parent = $this->iq_content_tree_node_parent){ $ret = $node_parent->getParentIdentifier(); return $ret.$node_parent->identifier."/"; } } // }