/home/techb158/immovalet.com/platform/packages/menu/src/Models
Edit: /home/techb158/immovalet.com/platform/packages/menu/src/Models/MenuNode.php (2530B)
belongsTo(MenuNode::class, 'parent_id');
}
/**
* @return HasMany
*/
public function child()
{
return $this->hasMany(MenuNode::class, 'parent_id')->orderBy('position');
}
/**
* @return BelongsTo
*/
public function reference()
{
return $this->morphTo()->with(['slugable']);
}
/**
* @param string $value
* @return string
*/
public function getUrlAttribute($value)
{
if ($value) {
return apply_filters(MENU_FILTER_NODE_URL, $value);
}
if (!$this->reference_type) {
return $value ? (string)$value : '/';
}
if (!$this->reference) {
return '/';
}
return (string)$this->reference->url;
}
/**
* @param string $value
*/
public function setUrlAttribute($value)
{
$this->attributes['url'] = $value;
}
/**
* @param string $value
* @return string
*/
public function getTitleAttribute($value)
{
if ($value) {
return $value;
}
if (!$this->reference_type || !$this->reference) {
return $value;
}
return $this->reference->name;
}
/**
* @return bool
*/
public function getActiveAttribute()
{
return rtrim(url($this->url), '/') == rtrim(Request::url(), '/');
}
/**
* @return mixed
* @deprecated
*/
public function hasChild()
{
return $this->has_child;
}
/**
* @return $this
* @deprecated
*/
public function getRelated()
{
return $this;
}
/**
* @return mixed
* @deprecated
*/
public function getNameAttribute()
{
return $this->title;
}
}